Site icon IT Tutorial

Oracle Linux Add route & Delete route Default Gateway

You can Change default gateway and routing settings. I will explain Oracle Linux Add route & Delete route Default Gateway in this post.

 

Linux Add route delete route default gateway

 

Add & Delete default gateway 

You can add default gateway to the linux like below.

route add default gw 192.168.163.1

 

If you want to delete default gateway you can execute like following script.

route delete default gw 192.168.163.1 eth1

 

 

Add route & Delete route

You can add routing and gateway settings like below.

route add -net 192.168.63.0/24 gw 192.168.163.1

Or if you want to do permanent routing, you can create route file like below.

[root@deveci02 ~]#
[root@deveci01 network-scripts]# cat route-eth1
192.168.63.0/24 via 192.168.163.1 dev eth1
192.168.161.0/24 via 192.168.161.1 dev eth0

 

If you create routing file like above then you can restart network service like below.

[root@deveci01 network-scripts]# service network restart

 

then Routing will be like below.

[root@deveci01 network-scripts]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.161.1 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 ibbond0
192.168.161.0 * 255.255.255.0 U 0 0 0 eth0
192.168.16.0 * 255.255.255.0 U 0 0 0 ibbond0
192.168.18.0 * 255.255.255.0 U 0 0 0 veth1
192.168.19.0 192.168.18.1 255.255.255.0 UG 0 0 0 veth1
192.168.63.0 192.168.163.1 255.255.255.0 UG 0 0 0 eth1
192.168.163.0 * 255.255.255.0 U 0 0 0 eth1


 

Do you want to learn Linux System Administration for Beginners, then read the following articles.

Exit mobile version