route

General support questions
Post Reply
good_face
Posts: 48
Joined: 2019/10/15 13:29:09

route

Post by good_face » 2020/11/11 15:18:52

i added route on server . Why can't I see the ip address under gatewey

route add -net 10.6.51.64 netmask 255.255.255.248 gw 10.156.254.33

[root@test1~]# route
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 0 0 0 bond1
10.6.51.64 gateway 255.255.255.248 UG 0 0 0 bond1
10.140.23.42 gateway 255.255.255.255 UGH 0 0 0 bond1
10.156.254.32 0.0.0.0 255.255.255.224 U 0 0 0 bond1

User avatar
jlehtone
Posts: 3180
Joined: 2007/12/11 08:17:33
Location: Finland

Re: route

Post by jlehtone » 2020/11/11 16:45:28

route is an old tool. A more advanced alternative, the iproute2 package was introduced two decades ago.
(I never bothered to learn to read the output of 'route'.)

The iproute2 shows routes with:

Code: Select all

ip ro
(which is actually a shorthand for ip route show)
One would add a route with:

Code: Select all

ip ro add 10.6.51.64/29 via 10.156.254.33
However, if you do have NetworkManager.service in use (which is the default), the you would not set route with 'ip' (or 'route'), except temporarily. You would would configure your connections with NM.
For example (assuming the name of connection is 'bond1'):

Code: Select all

nmcli connection modify bond1 +ipv4.routes "10.6.51.64/29 10.156.254.33"

kdpatil
Posts: 31
Joined: 2020/10/20 07:19:31

Re: route

Post by kdpatil » 2020/11/18 06:32:58

whats does netstat -nr shows ?

BShT
Posts: 370
Joined: 2019/10/09 12:31:40

Re: route

Post by BShT » 2020/11/18 18:37:17

traceroute or mtr

Post Reply

Return to “CentOS 7 - General Support”