|
3 | 3 |
|
4 | 4 | # Expect we were booted into a virtme-ng VM with "--net loop" |
5 | 5 |
|
6 | | -for ifc in eth0 eth1; do |
| 6 | +IFC0=enp0s1 |
| 7 | +IFC1=enp0s2 |
| 8 | + |
| 9 | +for ifc in $IFC0 $IFC1; do |
7 | 10 | if ! ethtool -i "$ifc" | grep -q virtio; then |
8 | 11 | echo "Error: $ifc is not virtio" |
9 | 12 | exit 1 |
10 | 13 | fi |
11 | 14 | done |
12 | 15 |
|
13 | 16 | ip netns add ns-remote |
14 | | -ip link set dev eth1 netns ns-remote |
| 17 | +ip link set dev $IFC1 netns ns-remote |
15 | 18 | export REMOTE_TYPE=netns |
16 | 19 | export REMOTE_ARGS=ns-remote |
17 | 20 |
|
18 | | -ip link set dev eth0 up |
19 | | -ip -netns ns-remote link set dev eth1 up |
20 | | -export NETIF=eth0 |
| 21 | +ip link set dev $IFC0 up |
| 22 | +ip -netns ns-remote link set dev $IFC1 up |
| 23 | +export NETIF=$IFC0 |
21 | 24 |
|
22 | | -ip addr add dev eth0 192.0.2.1/24 |
23 | | -ip -netns ns-remote addr add dev eth1 192.0.2.2/24 |
| 25 | +ip addr add dev $IFC0 192.0.2.1/24 |
| 26 | +ip -netns ns-remote addr add dev $IFC1 192.0.2.2/24 |
24 | 27 | export LOCAL_V4=192.0.2.1 |
25 | 28 | export REMOTE_V4=192.0.2.2 |
26 | 29 |
|
27 | | -ip addr add dev eth0 2001:db8::1/64 nodad |
28 | | -ip -netns ns-remote addr add dev eth1 2001:db8::2/64 nodad |
| 30 | +ip addr add dev $IFC0 2001:db8::1/64 nodad |
| 31 | +ip -netns ns-remote addr add dev $IFC1 2001:db8::2/64 nodad |
29 | 32 | export LOCAL_V6=2001:db8::1 |
30 | 33 | export REMOTE_V6=2001:db8::2 |
31 | 34 |
|
32 | | -sysctl -w net.ipv6.conf.eth0.keep_addr_on_down=1 |
| 35 | +sysctl -w net.ipv6.conf.$IFC0.keep_addr_on_down=1 |
33 | 36 | # We don't bring remote down, it'd break remote via SSH |
34 | 37 |
|
35 | 38 | sleep 1 |
0 commit comments