buntu下route命令详解
1、显示路由表
route -n
2、临时路由设置,重启网卡失效
#添加一条路由(发往192.168.62这个网段的全部要经过网关192.168.1.1)
route add -net 192.168.62.0 netmask 255.255.255.0 gw 192.168.1.1
#删除一条路由 删除的时候不用写网关
route del -net 192.168.122.0 netmask 255.255.255.0
#添加到主机的路由,删除将add换成del
# route add –host 192.168.168.110 dev eth0
# route add –host 192.168.168.119 gw 192.168.168.1
#添加到网络的路由
# route add –net IP netmask MASK eth0
# route add –net IP netmask MASK gw IP
# route add –net IP/24 eth1
#添加默认网关
# route add default gw IP
#删除路由
# route del –host 192.168.168.110 dev eth0
#修改路由
route change 192.168.3.98 netmask 255.255.255.0 192.168.3.45 #将目的ip为192.168.3.98且子网掩码为255.255.255.0的下一跳由x.x.x.x改为192.168.3.45
link