xref: /DragonOS/tools/configure_network.sh (revision af3543100543b9ac6159dc9f9367a76ff670b1f3)
1# Replace with your wired Ethernet interface name
2ETH=eno1
3
4sudo modprobe bridge
5sudo modprobe br_netfilter
6
7sudo sysctl -w net.bridge.bridge-nf-call-arptables=0
8sudo sysctl -w net.bridge.bridge-nf-call-ip6tables=0
9sudo sysctl -w net.bridge.bridge-nf-call-iptables=0
10
11sudo ip tuntap add name tap0 mode tap user $USER
12sudo brctl addbr br0
13sudo brctl addif br0 tap0
14sudo brctl addif br0 $ETH
15sudo ip link set tap0 up
16sudo ip link set $ETH up
17sudo ip link set br0 up
18
19
20# This connects your host system to the internet, so you can use it
21# at the same time you run the examples.
22sudo dhcpcd br0
23
24sudo mkdir -p /usr/local/etc/qemu
25sudo mkdir -p /etc/qemu
26sudo sh -c 'echo "allow br0" > /usr/local/etc/qemu/bridge.conf'
27sudo sh -c 'echo "allow br0" > /etc/qemu/bridge.conf'