系统 :Linux am335x 3.2.0 #594 Thu Oct 12 12:16:20 XJT 2017 armv7l GNU/Linux
1、查看网卡及ip地址
root@am335x:/# ifconfig
eth0 Link encap:Ethernet HWaddr 04:79:B7:1F:75:72
inet addr:192.168.0.15 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:813 errors:0 dropped:132 overruns:0 frame:0
TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:71674 (69.9 KiB) TX bytes:20825 (20.3 KiB)
eth1 Link encap:Ethernet HWaddr 04:79:B7:1F:75:74
inet addr:10.10.80.15 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
2、修改静态IP地址
(1)原来为静态IP情况
root@am335x:/# vi /etc/network/interface
点击 i -修改IP-按ESC键-输入:wq-回车保存
# The loopback interface
auto lo
iface lo inet loopback
# Wireless interfaces
iface wlan0 inet dhcp
wireless_mode managed
wireless_essid any
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
iface tiwlan0 inet dhcp
wireless_mode managed
wireless_essid any
iface atml0 inet dhcp
# Wired or wireless interfaces
auto eth0
#iface eth0 inet dhcp
# pre-up /bin/grep -v -e "ip=[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" /proc/cm
iface eth0 inet static
address 192.168.1.15 //修改为 192.168.1.15
gateway 192.168.1.1 //修改
netmask 255.255.255.0
auto eth1
#iface eth1 inet dhcp
iface eth1 inet static
address 10.10.80.15
gateway 10.10.80.1
netmask 255.0.0.0
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet dhcp
(2)、原来为自动设定IP的情况
auto loiface lo inet loopbackauto
eth0 iface eth0 inet dhcp
3、手动设置DNS服务器
打开文件 vi /etc/resolv.conf,修改内容如下 保存退出
nameserver 114.114.114.114
nameserver 192.168.1.1
4、重启网络服务
/etc/init.d/networking restart
输出
root@am335x:/# /etc/init.d/networking restart
Reconfiguring network interfaces... ifdown: misplaced option "o"
ifup: misplaced option "o"
done.
如果无效需断电重启