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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值