首页 > 其他 > 详细

(Mark) (Ubuntu)Ubuntu 12.04 LTS 添加虚拟网卡设置硬件MAC地址 (Linux) (MAC)

时间:2014-03-06 05:43:34      阅读:868      评论:0      收藏:0      [点我收藏+]

一、添加虚拟网卡配置MAC

1. 安装uml-utilities工具

bubuko.com,布布扣
sudo apt-get install uml-utilities
bubuko.com,布布扣

2.创建虚拟网卡 eth2

bubuko.com,布布扣
sudo tunctl -t eth2
bubuko.com,布布扣

3.为虚拟网卡eth2固定一个MAC地址

bubuko.com,布布扣
sudo ifconfig eth2 hw ether 00:11:22:33:44:55
bubuko.com,布布扣

4.启用虚拟网卡eth2

bubuko.com,布布扣
sudo ifconfig eth2 up
bubuko.com,布布扣

5.查看虚拟网卡eht2的MAC

bubuko.com,布布扣
ifconfig eth2

eth2      Link encap:以太网  硬件地址 00:11:22:33:44:55 
          UP BROADCAST MULTICAST  MTU:1500  跃点数:1
          接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:0 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:500 
          接收字节:0 (0.0 B)  发送字节:0 (0.0 B)
bubuko.com,布布扣

 注:在修改虚拟网卡eth2的MAC地址是要确保 eth2处于关闭状态,如果未关闭使用

bubuko.com,布布扣
sudo ifconfig eth2 down
bubuko.com,布布扣

修改完成后再开启

二、修改eth0 物理网卡的MAC

  1. Type the following command:
    sudo apt-get install uml-utilities
  2. Type the following command:

    cd /etc
  3. Open the rc.local file in your preferred text editor (vi, nano, etc.)

  4. Add the following lines to the end of the file. Replace XX:XX:XX:XX:XX:XX with the MAC address that you want to use:

    # Create the tap0 network interface:
    tunctl
    # Rename the tap0 interface to eth0:
    ip link set dev tap0 name eth0
    # Set the MAC address for the eth0 interface:
    ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX
    # Bring up the eth0 interface:
    ifconfig eth0 up
  5. Save the changes to the rc.local file and exit the text editor.

  6. Restart the system.

  7. After the system has restarted, you can view the network interfaces by typing the following command:

    ifconfig

(Mark) (Ubuntu)Ubuntu 12.04 LTS 添加虚拟网卡设置硬件MAC地址 (Linux) (MAC),布布扣,bubuko.com

(Mark) (Ubuntu)Ubuntu 12.04 LTS 添加虚拟网卡设置硬件MAC地址 (Linux) (MAC)

原文:http://www.cnblogs.com/think-o/p/3582737.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!