Ubuntu虛擬機多網(wǎng)卡配置
本文為大家分享了Ubuntu虛擬機多網(wǎng)卡配置,供大家參考,具體內容如下
1、場景說明
系統(tǒng)平臺:Ubuntu16.04
服務器:VMWare workstation 虛擬機12c
解決問題:添加4塊網(wǎng)卡(四個網(wǎng)段、四個網(wǎng)關),第4個網(wǎng)卡nat上網(wǎng),但是默認路由有問題
2、網(wǎng)卡配置內容
root@Ocommon:~# cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface #auto ens32 iface ens32 inet static address 1.1.1.2 netmask 255.255.255.0 gateway 1.1.1.1 #auto ens33 iface ens33 inet static address 2.2.2.2 netmask 255.255.255.0 gateway 2.2.2.1 #auto ens34 iface ens34 inet static address 3.3.3.2 netmask 255.255.255.0 gateway 3.3.3.1 #auto ens35 iface ens35 inet dhcp
注意:
但是在都添加“#auto ens3*”后啟動就會出現(xiàn)錯誤,所以將#auto ens3*全部去掉,但是啟動就出現(xiàn)不能網(wǎng)卡不能正常顯示。
3、Ubuntu虛擬機多網(wǎng)卡配置補充內容
按照以上配置Ubuntu16.04虛擬機網(wǎng)卡配置后,需要解決網(wǎng)卡啟動,多網(wǎng)段路由問題
cat >/etc/init.d/configNetwork<<EOF11 ifup ens32 ifup ens33 ifup ens34 ifup ens35 route add -net 1.1.1.0 gw 1.1.1.1 route add -net 2.2.2.0 gw 2.2.2.1 route add -net 3.3.3.0 gw 3.3.3.1 route del default gw 1.1.1.1 route add default gw 192.168.137.2 dev ens35 EOF11 chmod 111 /etc/init.d/configNetwork sed -i '/exit 0/i\bash /etc/init.d/configNetwork' /etc/rc.local
以上配置實現(xiàn)了:
1)系統(tǒng)啟動時,運行自定義的腳本(Ubuntu16.04啟動執(zhí)行腳本略有差異)
2)系統(tǒng)啟動時腳本執(zhí)行啟動網(wǎng)卡動作
3)系統(tǒng)實現(xiàn)多網(wǎng)段各自通信,每次啟動修改默認網(wǎng)關
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
VMware?vCenter6.7添加ESXI主機的教程圖解
這篇文章主要介紹了VMware?vCenter6.7添加ESXI主機,本文通過圖文并茂的形式給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-05-05警告1909無法創(chuàng)建快捷方式VMware Workstation Pro.Ink的圖文解決方法(附 VMware_wor
這篇文章主要介紹了警告1909無法創(chuàng)建快捷方式VMware Workstation Pro.Ink的圖文解決方法(附 VMware_workstation 12的安裝方法),需要的朋友可以參考下2017-01-01