网络配置相关命令

网络设备接口配置

interface f0/0
ip address 192.168.1.254 255.255.255.0
no shutdown

静态路由配置

ip router 192.168.2.0(访问地址) 255.255.255.0 192.168.12.2(下一跳地址)

动态路由配置

router rip
network 192.168.1.0
no router rip(删除动态路由)

静态默认路由

ip route 0.0.0.0 0.0.0.0 192.168.12.2(下一跳地址)

系统路由配置

系统静态默认路由配置
centos6:

route add default gw 10.0.0.254(添加)
route del default gw 10.0.0.254(删除)

centos7:

ip route add default via 10.0.0.254(添加)
ip route del default via 10.0.0.254(删除)

静态网段路由
centos6:

route add -net 223.5.5.5 netmask 255.255.255.0 gw 10.0.0.254(添加)
route del -net 223.5.5.5 netmask 255.255.255.0 gw 10.0.0.254(删除)

centos7:

ip route add 223.5.5.5/24 via 10.0.0.254(添加)
ip route del 223.5.5.5/24 via 10.0.0.254(删除)

静态主机路由
centos6:

route add -host 233.5.5.5 gw 10.0.0.254(添加)
route del -host 233.5.5.5 gw 10.0.0.254(删除)

centos7:

ip route add -host 233.5.5.5/32 via 10.0.0.254(添加)
ip route del -host 233.5.5.5/32 via 10.0.0.254(删除)

你可能感兴趣的:(网络配置相关命令)