CentOS 设置IP

广告
临时IP:立即生效 重启失效
ifconfig eth0 192.168.1.8 netmask 255.255.255.0
route add default gw 192.168.1.1
------------------------------------------------------
永久生效
vi /etc/sysconfig/network-scripts/ifcfg-eth0
内容如下
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.8
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
HWADDR=00:15:5D:E4:A2:BE
ONBOOT=yes
TYPE=Ethernet
------------------------------------------------------
设置dns
vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.
------------------------------------------------------
重启网卡
service network restart


Copyright myfse.cn Rights Reserved. 渝公网安备 50010802002026号 ICP备案:渝ICP备13002514号-10