VMware中,Ubuntu的網卡配置

先用ifconfig -a查看網卡名稱:

 

root@javie:~# ifconfig
eth2      Link encap:以太網  硬件地址 00:0c:29:14:68:7a 
          inet 地址:192.168.2.21  廣播:192.168.2.255  掩碼:255.255.255.0
          inet6 地址: fe80::20c:29ff:fe14:687a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  躍點數:1
          接收數據包:356079 錯誤:0 丟棄:0 過載:0 幀數:0
          發送數據包:51 錯誤:0 丟棄:0 過載:0 載波:0
          碰撞:0 發送隊列長度:1000
          接收字節:22086410 (22.0 MB)  發送字節:5230 (5.2 KB)
          中斷:19 基本地址:0x20a4

eth0_rename Link encap:以太網  硬件地址 00:0c:29:14:68:70 
          inet 地址:10.13.7.69  廣播:10.255.255.255  掩碼:255.0.0.0
          inet6 地址: fe80::20c:29ff:fe14:6870/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  躍點數:1
          接收數據包:860906 錯誤

 

 

然後再/etc/network/interfaces裏配置如下:

 

root@javie:~# cat /etc/network/interfaces
auto lo eth2   eth0_rename

iface eth0_rename  inet dhcp  //eth0_rename 網卡動態獲取
iface lo inet loopback               //eth2  網卡靜態配置
iface eth2 inet static
address 192.168.2.21
netmask 255.255.255.0

……

 

 

 

配置雙IP:

 

1 首先ifconfig 查看 你的網卡名字是什麼,如上是 eth2

 

2 虛擬網卡 eth2:0

 

auto lo auto eth2  eth2:0       
#iface eth1_rename inet dhcp
iface lo inet loopback

iface eth2 inet static
address 192.168.2.21
netmask 255.255.255.0
gateway 192.168.1.1


配置虛擬網卡的ip:

iface eth2:0 inet static 
address 10.13.7.71

netmask 255.0.0.0
gateway 10.13.7.254

 

4 重啓網絡

/etc/init.d/networking restart

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