全国咨询热线:0791-88811333 86216677

vps更换服务器后网卡不通的处理办法

2016-03-31 15:13:40   来源:   评论:0 点击:
vps更换服务器后网卡不通的处理办法

更换网卡vps主机不通,在更换服务器的时候linux的主机时常遇到这类问题。
具体处理办法是:


1.查看目前使用网卡和配置的实际mac地址(下面的使用的eth1)

[root@localhost ~]# vi /etc/udev/rules.d/70-persistent-net.rules

显示信息如下:(可能会多出一段是eth_sudu的)

# 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.

# net device ()

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:22:*", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:4a:ff:2a:23:3d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
~                                          

 


注意:ATTR{address}=="00:4a:ff:2a:23:3d"中的00:4a:ff:2a:23:3d为vps使用mac地址,如果与实际分配的不一样,必须修改成实际使用的

2.配置网卡信息(注意:ip,网关,掩码,配置与实际相同即可)
vi /etc/sysconfig/network-scripts/ifcfg-eth1

显示信息如下:

DEVICE="eth1"
ONBOOT="yes"
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPADDR=192.168.0.7
NETMASK=255.255.255.0
GATEWAY=192.168.0.1       

3.重启网卡服务

[root@localhost ~]# service network restart