設定網卡bridge
需以usb to uart 設置,在設置時網路會斷掉 無法用ssh
1.安裝 brctl工具
1 | sudo apt-get install bridge-utils |
2. 添加橋
1 2 3 4 5 6 7 8 | # brctl addbr br0 #創建橋接 br0 # brctl addif br0 eth0 usb0 #添加 eth0, eth1 到 br0 # ifconfig br0 192.168.12.2 netmask 255.255.255.0 broadcast 192.168.12.255 up 3. 打開ip轉發 #sudo vim /etc/systcl.conf net.ipv4.ip_forward=1 去掉該行前面的註釋符# sudo sysctl -p /etc/sysctl.conf |
文件立即生效
3. 修改 /etc/network/interfaces (static IP)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # This file intentionally left blank # # All interfaces are handled by network-manager, use nmtui or nmcli on # server/headless images or the "Network Manager" GUI on desktop images auto lo br0 iface lo inet loopback # Set up interfaces manually, avoiding conflicts with, e.g., network manager iface eth0 inet manual iface usb0 inet manual # Bridge setup iface br0 inet static bridge_ports eth0 usb0 address 192.168.12.2 broadcast 192.168.12.255 netmask 255.255.255.0 gateway 192.168.12.1 |
4. 重啟機器