ubuntu虛擬機啟用雙網卡IP配置


首先要登入自己的虛擬機,這里以ubuntu為例。

配置兩塊網卡,一塊eth0為NAT模式,另一塊為eth1僅主機模式

 

# 進入網卡配置頁面
vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.60.202
        netmask 255.255.255.0
        network 192.168.60.0
        broadcast 192.168.60.255
        gateway 192.168.60.2
auto eth1
iface eth1 inet static
        address 192.168.15.202
        netmask 255.255.255.0
        network 192.168.15.0
        broadcast 192.168.15.255
     # 此塊網卡不配置網關

然后重啟網卡即可

/etc/init.d/networking restart

如果ping不通域名

則需要修改此文件

vim /etc/resolv.conf

修改添加一下內容,即可

search localdomain
nameserver 8.8.8.8

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM