且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linux 交换eth0和eth1

更新时间:2022-08-12 20:20:48

一、参考文档:
    如何交换eth0和eth1?
        http://bbs.chinaunix.net/archiver/tid-2026056.html   

二、具体操作
    #echo `ifconfig -a` 
    ifconfig eth0 down
    ifconfig eth1 down
    ip link set dev eth0 name eth2
    ip link set dev eth1 name eth0
    ip link set dev eth2 name eth1
    ifconfig eth0 up
    ifconfig eth1 up
    #echo `ifconfig -a`

三、修改过后OK335xS上遇到的问题:
    1. 设置了以上内容以后,在串口的调试口上的eth0、eth1是没有变换的;
    2. 在使用Qt应用程序上获取网卡设置的时候,eth0、eth1是换了的;
    3. 目前原因未知,可能是因为环境变量导致的问题。