ubuntu

经常用RHEL,一天帮朋友配置ubuntu系统的网卡,发现它俩的网卡配置文件还是有区别的,现在写几个配置文件如下:

网卡配置文件为:/etc/network/interfaces
1、使用DHCP找到ip地址:
auto eth0
iface eth0 inet dhcp

# sudo /etc/init.d/networking restart
或者使用下面的手动获得ip地址:
# sudo dhclient eth0

2、为网卡配置静态ip地址:
auto eth0
iface eth0 inet static
address 217.156.7.158
netmask 255.255.255.0
gateway 217.156.7.1

# sudo /etc/init.d/networking restart

3、设定第二个ip地址(虚拟ip地址)
auto eth0:1
iface eth0:1 inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

# sudo /etc/init.d/networking restart

**********************************************************************************
为什么在ubuntu 系统里用more /etc/network/interfaces 配置文件时只有auto lo的配置文件。为什么没有eth0设备的配置文件? 但是用ifconfig eth0查IP时又有IP,同时还能上网,这是为什么?
因为系统是eth0网卡的配置是通过networkmanager管理的。

注:文章摘自网上,忘了取自哪里,请作者看到莫见怪。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章