Skip to content

Commit

Permalink
Switch from ifname to device
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Champetier <[email protected]>
  • Loading branch information
champtar committed Aug 22, 2021
1 parent d8d3d5f commit 26bd876
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,28 @@ opkg install phantap
* Either reboot the device, or run `/etc/init.d/phantap setup`.
* Get the interface names from that device:
```
# uci show network | grep ifname
network.loopback.ifname='lo'
network.lan.ifname='eth1'
network.wan.ifname='eth0'
network.wan6.ifname='eth0'
# uci show network | grep -E 'device=|ports='
network.loopback.device='lo'
network.@device[0].ports='eth0'
network.lan.device='br-lan'
network.wan.device='eth1'
network.wan6.device='eth1'
network.phantap.device='br-phantap'
```
In this example we are using a GL-AR150, which only has 2 interfaces.

* Remove the interfaces from any network interface they might be used by, if that's the case, via the following commands in the cli
(assuming we are using a GL-AR150):
```
uci delete network.lan.ifname
uci delete network.wan.ifname
uci delete network.wan6.ifname
uci delete network.@device[0].ports
uci delete network.wan.device
uci delete network.wan6.device
```
* Add the interfaces to the phantap bridge and restart the network service via the following commands in the cli
(assuming we are using a GL-AR150):
```
uci set network.phantap.ifname='eth0 eth1'
uci add_list network.br_phantap.ports='eth0'
uci add_list network.br_phantap.ports='eth1'
uci commit network
/etc/init.d/network reload
```
Expand Down
35 changes: 20 additions & 15 deletions files/etc/init.d/phantap
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,32 @@ setup() {
uci set system.ntp.enabled=0
uci set system.ntp.server=''

np=network.phantap
nip=network.phantap
ndp=network.br_phantap
uci batch <<EOF
set $np=interface
set $np.type='bridge'
set $np.proto='static'
set $np.ipaddr='169.254.66.100'
set $np.netmask='255.255.255.254'
set $np.gateway='169.254.66.101'
set $np.dns=''
set $np.ifname=''
set $np.ipv6='0'
set $nip=interface
set $nip.device='br-phantap'
set $nip.proto='static'
set $nip.ipaddr='169.254.66.100'
set $nip.netmask='255.255.255.254'
set $nip.gateway='169.254.66.101'
set $nip.dns=''
set $nip.ipv6='0'
set $ndp=device
set $ndp.type='bridge'
set $ndp.name='br-phantap'
set $ndp.ipv6='0'
EOF
echo "To finish phantap configuration, start by setting up wifi,"
echo "then get the interface names from the device"
echo "uci show network | grep ifname"
echo "uci show network | grep -E 'device=|ports='"
echo "If the interfaces are part of an interface already, remove them (assuming we are using a GL-AR150)"
echo "uci delete network.lan.ifname"
echo "uci delete network.wan.ifname"
echo "uci delete network.wan6.ifname"
echo "uci delete network.@device[0].ports"
echo "uci delete network.wan.device"
echo "uci delete network.wan6.device"
echo "Add the interfaces to the phantap bridge and restart the network service (assuming we are using a GL-AR150)"
echo "uci set network.phantap.ifname='eth0 eth1'"
echo "uci add_list network.br_phantap.ports='eth0'"
echo "uci add_list network.br_phantap.ports='eth1'"
echo "uci commit network"
echo "/etc/init.d/network reload"

Expand Down

0 comments on commit 26bd876

Please sign in to comment.