CentOS 与Ubuntu 下配置IP地址

1.CentOS配置方法如下:

用vi打开配置文件

[root@haha3 ~]#  vi /etc/sysconfig/network-scripts/ifcfg-eth0

写入以下配置

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.8
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=10.36.15.3

:wq 保存退出

 

 2.Ubuntu下配置方法:

 用vi 打开配置文件

扫描二维码关注公众号,回复: 5148409 查看本文章

  sudo vi/etc/network/interfaces

写入以下配置

auto eth0                  
iface eth0 inet static      
address 192.168.1.8      
netmask 255.255.255.0      
gateway 192.168.1.1
dns-nameservers 10.36.15.3

 :wq 保存退出

 重启后生效

猜你喜欢

转载自www.cnblogs.com/happybaymax/p/10351738.html
今日推荐