pi-debian@raspberypi:~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether d8:3a:dd:c4:f5:2c brd ff:ff:ff:ff:ff:ff
inet6 fe80::dd8d:d61e:bd0d:c1c/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether d8:3a:6d:c4:f5:2e brd ff:ff:ff:ff:ff:ff
inet 192.168.10.12/24 brd 192.168.10.255 scope global dynamic noprefixroute wlan0
valid_lft 86399sec preferred_lft 86399sec
inet6 fe80::52a4:7d96:cc7e:7018/64 scope link noprefixroute
valid_lft forever preferred_lft forever
pi-debian@raspberrypi:~ $ ip r
default via 192.168.10.1 dev wlan0 proto dhcp src 192.168.10.12 metric 600
192.168.10.0/24 dev wlan0 proto kernel scope link src 192.168.10.12 metric 600
pi-debian@raspberrypi:~ $
在断开wlan0连接的wifi后,设置/etc/network/interfaces如下:
cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
auto eth0
iface eth0 inet static
dress 192.168.3.32
netmask 255.255.255.0
gateway 192.168.3.1