linux網絡命令

一、linux下添加路由

1、添加默認網關:route add default gw 192.168.1.1 或 route add default dev eth1

2、添加路由:route add -net 172.16.1.0 netmask 255.255.255.0 gw 172.16.1.1

             route add -net 172.16.1.0 netmask 255.255.255.0 dev eth0

3、添加一個主機路由:route add -host 172.16.1.1 gw 172.16.1.10

                     route add -host 172.16.1.1 dev eth0

4、刪除:route del [default/-host/-net]

5、查看路由:route -n 或 netstat -rn

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.60.3    192.168.60.1    255.255.255.255 UGH   0      0        0 eth1

172.17.46.0     172.17.46.1     255.255.255.0   UG    0      0        0 eth0

172.17.46.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

192.168.60.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1

0.0.0.0         172.17.46.1     0.0.0.0         UG    0      0        0 eth0

0.0.0.0         192.168.60.2    0.0.0.0         UG    0      0        0 eth1


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章