添加路由,给网卡添加网址
自己记录一下:
由于网络没有ping通,所以增加了下面操作
动态给网卡添加路由:
ifconfig eth0 172.30.92.204 netmask 255.255.255.0
重启生效,需配置文件/etc/sysconfig/network-script/ifcfg-eth0
# 文件后缀eth0为对应网卡名
BOOTPROTO=static
DEVICE=eth0 IPADDR=172.30.92.204 NETMASTK=255.255.255.0 GATEWAY=172.30.92.1
动态添加路由:
route add -net 0.0.0.0 gw 162.168.2.1
查看路由是否成功加了:
route -n
重启网络systemctl restart network

浙公网安备 33010602011771号