参考
拷贝interfaces文件
nginx
scp /etc/network/interfaces wpf@192.168.1.4:/home/wpf/workspace/nfs/z8_rootfs/etc/network/
shell
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# 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 atml0 inet dhcp
# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
iface eth1 inet dhcp
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
# Bluetooth networking
iface bnep0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "ming"
wpa-psk "123456"
三网通
cat /etc/network/interfaces
verilog
auto lo
iface lo inet loopback
iface wlan0 inet dhcp
wireless_mode managed
wireless_essid any
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
iface atml0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.1.88
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 1.1.1.1
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
iface bnep0 inet dhcp
PC端dns配置
bash
minglie@minglie:~$ ping baidu.com
ping: baidu.com: 未知的名称或服务
minglie@minglie:~$ ping 8.8.8.8
connect: 网络不可达
minglie@minglie:~$ sudo dhclient -4 ens33
minglie@minglie:~$ ping baidu.com
PING baidu.com (39.156.70.37) 56(84) bytes of data.
64 bytes from 39.156.70.37 (39.156.70.37): icmp_seq=1 ttl=128 time=29.0 ms
/etc/resolv.conf DNS 配置
html
echo "nameserver 192.168.1.1" > /etc/resolv.conf
shell
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
shell
# Wireless interfaces
iface wlan0 inet dhcp
wireless_mode managed
wireless_essid any
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
iface atml0 inet dhcp
# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
iface eth1 inet dhcp
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
# Bluetooth networking
iface bnep0 inet dhcp
重启网卡
json
ifdown eth0
ifup eth0
开发板挂载虚拟机的nfs
192.168.1.90:/home/minglie/workspace/nfs/rootfs/home/workspace 是虚拟机
/mnt 是开发板
bash
mount -t nfs -o nolock 192.168.1.90:/home/minglie/workspace/nfs/rootfs/home/workspace /mnt
不能ping 百度
shell
root@z8:~# ping baidu.com
ping: bad address 'baidu.com'
ping 8.8.8.8
shell
cat > /etc/resolv.conf <<EOF
nameserver 8.8.8.8
nameserver 114.114.114.114
EOF
多IP问题
json
root@as:~/soft# ip addr show $INTERFACE
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
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 00:0a:35:00:1e:54 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 scope global eth0
valid_lft forever preferred_lft forever
inet 192.168.8.4/24 brd 192.168.8.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fde2:7d37:131b:b700:20a:35ff:fe00:1e54/64 scope global dynamic mngtmpaddr
valid_lft 7165sec preferred_lft 3565sec
inet6 2409:8d28:323:762a:20a:35ff:fe00:1e54/64 scope global dynamic mngtmpaddr
valid_lft 7165sec preferred_lft 3565sec
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
删除1个ip
json
ip addr del 192.168.1.100/24 dev eth0
查看mac地址
bash
ip link show
mac地址冲突问题
bash
printenv ethaddr
setenv ethaddr 00:0a:35:00:1e:54
saveenv
双网卡配置
bash
# 1. 确保 eth0 和 wlan0 都正常工作
ip addr show eth0
ip addr show wlan0
# 2. 配置默认路由
# 删除原有的默认路由
ip route del default
# 添加新的默认路由,通过 wlan0 网卡
ip route add default via 192.168.1.1 dev wlan0
# 3. 配置特定路由
ip route add 192.168.8.0/24 via 192.168.8.1 dev eth0
# 4. 验证配置
ip route show
无线网卡配置
https://www.cnblogs.com/han-guang-xue/p/17325526.html
RTL8188EUS USB WIFI 模块
shell
/opt/hardwareTest/usb_wifi_setup.sh langjie2024 work4@2024 wlan0
/opt/hardwareTest/usb_wifi_setup.sh langjie2025 work42025 wlan0
wpa_supplicant -B -i wlan0 -c <(wpa_passphrase "langjie2025" "work42025")
shell
/opt/hardwareTest/usb_wifi_setup.sh langjie2025 work42025 wlan0
cd /home/root/workspace/actionstation/phymac/bin && ./phymac_petalinux > logs/`date +"%Y-%m-%d%H%M%S".log` 2>&1 &
plain
udhcpc -i wlan0 -n
plain
iwlist wlan0 scan