linux配置ip

vi /etc/sysconfig/network-scripts/ifcfg-eth0node

DEVICE=eth0
HWADDR=00:0C:29:0B:E9:46
TYPE=Ethernet
UUID=290c1baf-9236-461a-86de-f702d94457f2
#開機啓用
ONBOOT=yes
NM_CONTROLLED=yes
#靜態IP
BOOTPROTO=static

#BROADCAST=192.168.134.255
#IP地址
IPADDR=192.168.134.150
#子網掩碼
NETMASK=255.255.255.0
#NETWORK=192.168.134.0
#網關
GATEWAY=192.168.134.2
#配置DNS
DNS1=114.114.114.114
DNS2=10.203.104.41

重啓網卡生效 centos6的網卡重啓方法:service network restart centos7的網卡重啓方法:systemctl restart networkcentos

okoop

其它ip相關命令ui

centos 查看網關的命令centos7

1.ifconfig -a 和 cat /etc/resolv.conf (主要查看ip/netmask和dns)spa

2.netstat -rn.net

3.cat /etc/sysconfig/networkrest

4.cat /etc/sysconfig/network-scripts/ifcfg-eth0code

5.traceroute 第一行就是本身的網關dns

6.ip route show

7.route -n

複製虛擬機後,開機選擇 移動虛擬機 網卡啓動失敗

[root@c1node01 ~]# service network restart
Shutting down loopback insterface:                                                       [   OK  ]
Bringing up loopback insterface:                                                            [   OK  ]
Bringing up interface eth0:  Device eth0 does not seem to be present,delaying initialization.                    [FAILED]
方案1
rm -rf /etc/udev/rules.d/70-persistent-net.rules
重啓虛擬機
方案2
/etc/sysconfig/network-scripts/ifcfg-eth0 
重命名爲eth1
打開文件 
DEVICE="eth1"
刪掉uuid、物理地址
重啓網卡
相關文章
相關標籤/搜索