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管理的。

注:文章摘自網上,忘了取自哪裏,請作者看到莫見怪。

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