linux 网卡相关命令

1. ifconfig  //查看网络相关信息

2. ifconfig eth0 192.168.1.103 netmask 255.255.255.0  //配置eth0的IP地址

3. route -n  //查询路由信息

4. route add default gw 192.168.1.1

 

使用 ifconfig eth0 192.168.1.103 netmask 255.255.255.0 配置IP后开发板重启,IP地址丢失需要重新配置。

vim /etc/network/interfaces

auto eth0
iface eth0 inet static
        address 192.168.1.41
        gateway 192.168.1.1
        netmask 255.255.255.0
        dns-nameserver 114.114.114.114
重启网卡
  ifdown eth0
  ifup eth0
eth0的IP地址则固定。
posted @ 2016-05-25 16:21  emlslxl  阅读(408)  评论(0编辑  收藏  举报