原创
Ubuntu 虛擬網卡設定方式
2010-8-13 16:35
5041
10
10
分类:
通信
# sudo vi /etc/network/interfaces 增加虛擬網卡設定
auto eth0
iface eth0 inet static
address 192.168.1.253
netmask 255.255.255.0
gateway 192.168.1.254
====以下為虛擬網卡設定====
auto eth0:0
iface eth0:0 inet static
address 192.168.2.253
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
====以上為虛擬網卡設定====
# sudo /etc/init.d/networking restart 重新啟動網路服務
* Reconfiguring network interfaces...
SIOCSIFFLAGS: Cannot assign requested address [ OK ]
# route 確認是否有新增虛擬網卡的Route產生
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default my.router 0.0.0.0 UG 100 0 0 eth0
# ping 192.168.1.100 測試192.168.1.X 是否連線
PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
64 bytes from 192.168.1.100: icmp_seq=1 ttl=128 time=0.112 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=128 time=0.116 ms
--- 192.168.1.100 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.112/0.114/0.116/0.002 ms
#ping 192.168.2.100 測試192.168.2.X 是否連線
PING 192.168.2.100 (192.168.2.100) 56(84) bytes of data.
64 bytes from 192.168.2.100: icmp_seq=1 ttl=128 time=5.22 ms
64 bytes from 192.168.2.100: icmp_seq=2 ttl=128 time=0.122 ms
--- 192.168.2.100 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1006ms
rtt min/avg/max/mdev = 0.122/2.671/5.221/2.550 ms
以上就是在Ubuntu上面新增一張虛擬網卡的方式
文章评论(0条评论)
登录后参与讨论