以區域網路環境為例

1. Base為Windows主機,已可上Internet

2. 安裝VirtualBox

3. VirtualBox建立VM並安裝Linux(CentOS)

4. 該VM網路卡部份選Bridge(橋接界面卡),預設是NAT,並選擇Windows主機上的網路卡
virtualbox.jpg

5. Linux(CentOS)指定相關IPGW、DNS設定IP
# ifconfig eth0 192.168.2.100 netmask 255.255.255.0

設定Gateway
# route add default gw 192.168.2.254 dev eth0

設定DNS
vi /etc/resolv.conf
nameserver 192.168.2.5 ==> 區域網路內的DNS,若有的話就指定區域內的,若無就用Google或中華電信的
nameserver 8.8.8.8 ==> Google的DNS
nameserver 168.95.1.1 ==> 中華電信的DNS

以上設定直接生效,不需重新開機後才生效

完工,該VM已可上Internet

 

【補充】
修改Hostname
# hostname centos1

重新啟動網卡
# /etc/init.d/network restart

arrow
arrow

    天堂哞 發表在 痞客邦 留言(0) 人氣()