Using Linux 'netstat' command to display or view kernel IP routing table.
[root@linux hack]# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
203.106.93.64 * 255.255.255.224 U 0 0 0 eth0
10.2.0.0 * 255.255.0.0 U 0 0 0 eth1
10.3.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.6.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.7.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.4.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.5.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.10.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.8.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
10.9.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
default 203.106.93.93 0.0.0.0 UG 0 0 0 eth0
[root@linux hack]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
203.106.93.64 0.0.0.0 255.255.255.224 U 0 0 0 eth0
10.2.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
10.3.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.6.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.7.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.4.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.5.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.10.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.8.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
10.9.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
0.0.0.0 203.106.93.93 0.0.0.0 UG 0 0 0 eth0
Using Linux 'route' command to display kernel IP routing table.
[root@linux hack]# /sbin/route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
203.106.93.64 * 255.255.255.224 U 0 0 0 eth0
10.2.0.0 * 255.255.0.0 U 0 0 0 eth1
10.3.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.6.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.7.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.4.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.5.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.10.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
10.8.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
10.9.0.0 10.2.0.2 255.255.0.0 UG 0 0 0 eth1
default 203.106.93.93 0.0.0.0 UG 0 0 0 eth0
Step-by-step how to add/change default route on Linux Fedora Core machine.
You can add default route on your Linux machine by using route command.
[root@linux hack]# route add default gw 10.10.0.1 eth0
Add or edit the default gateway on /etc/sysconfig/network file, to make sure your default is preserve after your system boot.
Configuration example on network file:
NETWORKING=yes
HOSTNAME=fedora.hacking.com
GATEWAY=203.106.93.93
Or you can place the (# route add default gw 10.10.0.1 eth0) command to the rc.local script file. This rc.local script file is located under /etc/rc.d/rc.local. This rc.local script file are design to run at the end of each boot time.
Không có nhận xét nào:
Đăng nhận xét