↑ Top
Kaai24
dev studios
| Sign in | DE EN

Routing in Linux

This is an example of how to change a default Gateway

Show routes

route -n

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

Add a gateway route

route add default gw 192.168.0.2 eth0

delete a route

route del -net 0.0.0.0 gw 192.168.0.1 netmask 0.0.0.0 dev eth0

Comments