Linux 网卡配置

来源:互联网 发布:腾讯云计算 编辑:程序博客网 时间:2024/05/29 18:42

网卡配置文件存放位置

redhat : /etc/syscofig/netowork-scriptsifcfg-eth0

DEVICE=eth0

BOOTPROTO=static

HWADDR=00:22:46:02:89:3C

ONBOOT=yes

IPADDR=192.168.1.110

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

 

设置DNS echo ‘nameserver’>  /etc/resolv.conf

重启:/etc/init.d/network restart 即可

 

Ubuntu

静态IP需要手动设置,设置方法是:

sudo vi /etc/network/interfaces :

auto eth0

# iface eth0 inet dhcp

iface eht0 inet static

address 192.168.1.254

netmask 255.255.255.0

gateway 192.168.1.1

nameserver 192.168.1.1

 

sudo /etc/init.d/networking restart