修改网卡信息
vi /etc/sysconfig/network-scripts/ifcfg-eth0E=eth0 #网卡名称HWADDR=00:0c:29:5c:94:74 #物理地址TYPE=EthernetUUID=36c43db3-95a9-427c-af8f-ba130189de85ONBOOT=yes #将ONBOOT=\"no\"改为ONBOOT=\"yes\"NM_CONTROLLED=yesBOOTPROTO=none #自动获取BOOTPROTO=dhcp/staticIPADDR=192.168.1.98 #修改IP地址NETMASK=255.255.255.0 #修改子网掩码GATEWAY=192.168.1.1 #修改网关DNS1=8.8.8.8 #修改DNS服务器IPV6INIT=noUSERCTL=no
重启网络服务:
要想生效,必须重启Linux或者重启网络服务,我们重启网络服务,执行如下命令:
service network restart #centos6systemctl restart network #centos7
查看DNS
#cat /etc/resolv.confsearch example.comnameserver 192.168.0.222