给开发板设置静态IP

一般我们的用法是插上网线然后去路由里找IP,但是偶尔也会变,造成一些麻烦,如何设置固定IP呢,应该很简单,只是做一下实际操作的纪录,首先通过 cat /etc/network/interfaces 看一下网络设置

# Wired adapter #1
auto eth0
        iface eth0 inet dhcp
#       hwaddress ether # if you want to set MAC manually
#       pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838
#
# Wired adapter #2
#auto eth1
#       iface eth1 inet dhcp
#       hwaddress ether # if you want to set MAC manually
#       pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838
#
# Wireless adapter #1
#auto wlan0
#       iface wlan0 inet dhcp
#       wpa-ssid SSID
#       wpa-psk xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# to generate proper encrypted key: wpa_passphrase yourSSID yourpassword
#
# Local loopback
auto lo
        iface lo inet loopback

下面需要做的就是注释掉 iface eth0 inet dhcp 然后用下边的代码替换

iface eth0 inet static
address 192.168.1.88
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1

然后可以重起板子或者/etc/init.d/networking restart

标签: none

添加新评论