1、修改静态IP后无法ping通外网
访问不同的网络,我们需要添加路由来决定发送的数据包经过正确的网关能正确的进行通信
[root@mini1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 TYPE=Ethernet ONBOOT=yes BOOTPROTO=static IPADDR=192.168.33.61 NETMASK=255.255.255.0 GATEWAY=192.168.33.1 |
1、需要设置网关
route add default gw 192.168.33.1 |
2、添加nameserver
vi /etc/resolv.conf nameserver 192.168.33.1 |
2、克隆Linux系统后eth0不见
方法一:
1、编辑/etc/udev/rules.d/70-persistent-net.rules文件
2、把NAME="eth0"的那行配置注释掉或者删掉,把NAME="eth1"的修改成NAME="eth0"
[root@mini1 ~]# vi /etc/udev/rules.d/70-persistent-net.rules # PCI device 0x8086:0x100f (e1000) |
方法二:
1、直接修改 vi /etc/sysconfig/network-script/ifcfg-eth0
2、配置静态地址
3、rm -rf /etc/udev/rules.d/70-persistent-net.rules
4、reboot