Unable to add route with a specific gateway IP

Thread Tools Search this Thread
Operating Systems Linux Unable to add route with a specific gateway IP
# 1  
Old 02-18-2019
Unable to add route with a specific gateway IP


This is the routing table on a RHEL 7 server :

[root@SIEMsmartcon3 ~]# route -n
Kernel IP routing table
Destination	Gateway		Genmask		Flags	Metric	Ref	Use Iface		UG	100	0	0   eno49	U	100	0	0   eno49	U	100	0	0   eno49	U	1003	0	0   eno50

I tried to add a route like this, however as shown an error is thrown :

[root@SIEMsmartcon3 ~]# ip route add via dev eno50
RTNETLINK answers: Network is unreachable

The gateway is used as a gateway for another interface in the server (eno50).
Why is the error above thrown when I try to add that line? Is it because that gateway is not initiated as a default gateway in the routing table?
# 2  
Old 02-18-2019
Are you sure you want to add the network on that host? The ...160 is outside your subnet, so you must route through ...145, the default gateway. Please post the output of arp -a or arp -e of the two nodes on your LAN segment.
# 3  
Old 02-18-2019

Thank you for your reply. However, there are no two servers involved, only one. These are the outputs requested :

[root@SIEMsmartcon3 ~]# arp -a
? ( at 00.17:a4:77;a4:56 [ether] on eno50
? ( at ec:eb:b8:9f:01:26 [ether] on eno50
? ( at 00:10:db:ff:20:04 [ether] on eno50 gateway ( at 00:10:db:ff:20:04 [ether] on eno49
? ( at 00:17:a4:77:a4:52 [ether] on eno49

[root@SIEMsmartcon3 ~]# arp -e
Address		HWtype	HWaddress		Flags Mask	Iface	ether	00:17:a4:77:a4:56	C		eno50	ether	ec:eb:b8:9f:01:26	C		eno50	ether	00:10:db:ff:20:04	C		eno50
gateway		ether	00:10:db:ff:20:04	C		eno49	ether	00:17:a4:77:a4:52	C		eno49

Best Regards,
# 4  
Old 02-18-2019
I'm a bit puzzled. Did you use "alias interfaces", as both seem to share the same MAC address? Pls show the output from ifconfig or its ip equivalent.
# 5  
Old 02-18-2019
According to your routing table the IP-Network for the gateway ( is connected via NIC eno50. But the route-setup command points to NIC eno49.

Maybe you should just omit the dev eno50 in your route command or change your ip configuration so that 10.31.181... is configured to eno50 instead of eno49.

And yes /28 is smaller than expected. As RudiC said the gateway is outside your subnet anyway. The gateway must be located within one of the configured subnets of your server.

Last edited by stomp; 02-18-2019 at 08:36 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Inconsistency between RedHat 6.5 global gateway and single gateway leads to loss of default gateway

Dear friends I use RedHat 6.5, which sets the gateway in the configuration file / etc / sysconfig / network as GATEWAY =, and the gateway in the configuration file / etc / sysconfig / network-scripts / ifcfg-eth11 as GATEWAY = The two gateways are different.... (6 Replies)
Discussion started by: tanpeng
6 Replies

2. Red Hat

Set new gateway for route to internet

Hi all, i have a rhel 6.2 with a default gateway. This server is an Intranet office with no internet access. DNS are already configured and it's possible to resolve my target. My goal is to link my application (apache forward) only to http://mytarget.yyy through a new gateway (That does... (0 Replies)
Discussion started by: kamose
0 Replies

3. UNIX for Advanced & Expert Users

Unable to ping default gateway

I have setup a Linux machine on my server but for some reason Im unable to reach my default gateway. This is causing me to not communicate with the outside world (unable to connect to CentOS repos) # ifconfig enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies

4. AIX

IBM Server doesn't ping gateway unless you put a static route

Just want to know if someone has a clue about what could be happening here: I have an AIX box with four NICs in Ether channel connected to a Cisco Switch. When I try to ping the default gateway, sometimes it works, but sometimes it doesn't work unless it has a defined static route. Thanks... (1 Reply)
Discussion started by: witt
1 Replies

5. Solaris

Route Add

Hi, I am trying to add route command in Solaris 10 machine in the following fashion: route add -host -interface lo0:1 this command fails with an error "lo0:1: bad value" I want to add a route to that picks as the gateway via the... (3 Replies)
Discussion started by: sudhir_shet
3 Replies

6. IP Networking

Unable to ping the gateway IP itself

We are unable to bring one of our linux boxes into the network once it was restarted. But once we stop and start the network service. We are able to ping the gateway and get into network. After a minute or two we get the following reponse for the ping command 64 bytes from (6 Replies)
Discussion started by: chrisanto_2000
6 Replies

7. Shell Programming and Scripting

script to change default route when primary gateway dies

Hello all! We have two fedora routers one at each site. What we are trying to do worked using freesco but not on fedora, i'm not very good at scripting and need a little guidence. Basicly what we are trying to do is if the primary line dies, the router will change it's routes to go through our... (0 Replies)
Discussion started by: slacker
0 Replies

8. IP Networking

Do I need to add a route??

I have two networks connected by cisco routers. My first subnet is and my second is My SCO unix machine is on the subnet with an IP of It can see the entire .1.0 subnet but nothing on the other network. My cicso router(gateway) to the other... (6 Replies)
Discussion started by: agoodrich
6 Replies

9. AIX

route add

Hello , We have 3 rs/6000 server's running aix on our local network, so each time I try to ping one of these servers we get a "network is down" error , I've been instructed to use to route add command which is ... #route add server.ip router.ip after this the ping command works fine ,... (6 Replies)
Discussion started by: cubicle^dweller
6 Replies

10. UNIX for Dummies Questions & Answers

Add route gateway -> Restart !! Lose it

:confused: Hi: I donīt know how to add route gateway and when restart the machine lose this route and put other. In SCO ver 5.6 Enterprise write: etc\route delete gateway route add gateway so , netstat -rn to see if has change -> all ok Restart -> !!!... (2 Replies)
Discussion started by: AlvaroD
2 Replies
Login or Register to Ask a Question

Featured Tech Videos