Linux_centos修改静态IP后无法ping通外网,及克隆后eth0不见的问题

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
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:28:6f:8e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

方法二:

1、直接修改  vi /etc/sysconfig/network-script/ifcfg-eth0

2、配置静态地址

3、rm -rf /etc/udev/rules.d/70-persistent-net.rules

4、reboot

猜你喜欢

转载自blog.csdn.net/weixin_36490014/article/details/81364249
今日推荐