Open dl1com opened 4 years ago
Current default settings:
[NETWORK]
hostname = pluto
ipaddr = 192.168.2.1
netmask = 255.255.255.0
dhcp_server_pool_start = 192.168.2.10
dhcp_server_leasetime = 600
dhcp_server_gateway = 192.168.2.1
[WLAN]
ssid_wlan =
pwd_wlan =
ipaddr_wlan =
[USB_ETHERNET]
ipaddr_eth =
netmask_eth = 255.255.255.0
[HNAP_NETWORK]
ipaddr_tap =
netmask_tap = 255.255.255.240
dhcp_server_pool_start_tap =
dhcp_server_leasetime_tap = 600
dhcp_server_gateway_tap =
[NAT]
nat_interface = HNAP_NETWORK
[BRIDGE]
master_interface =
slave_interface_1 =
ipaddr
/ipaddr_tap
are unset, this interface acts as a DHCP clientdhcp_server_pool_start
/dhcp_server_pool_start_tap
is set, a DHCP server is started on this interfaceNETWORK
, WLAN
, USB_ETHERNET
, HNAP_NETWORK
Current default settings:
[NETWORK]
hostname = pluto
ipaddr = 192.168.2.1
netmask = 255.255.255.0
dhcp_server_pool_start = 192.168.2.10
dhcp_server_leasetime = 600
dhcp_server_gateway = 192.168.2.1
dhcp_server_dns = 192.168.2.1
[WLAN]
ssid_wlan =
pwd_wlan =
ipaddr_wlan =
[USB_ETHERNET]
ipaddr_eth =
netmask_eth = 255.255.255.0
[HNAP_NETWORK]
ipaddr_tap =
netmask_tap = 255.255.255.240
dhcp_server_pool_start_tap =
dhcp_server_leasetime_tap = 600
dhcp_server_gateway_tap =
dhcp_server_dns_tap =
[NAT]
nat_interface = HNAP_NETWORK
[BRIDGE]
bridge_master_interface =
bridge_slave_interface_1 =
NETWORK
interface works only with static IP, no DHCP clientipaddr_eth
/ipaddr_tap
are unset, this interface acts as a DHCP clientdhcp_server_pool_start
/dhcp_server_pool_start_tap
is set, a DHCP server is started on this interfaceNETWORK
, WLAN
, USB_ETHERNET
, HNAP_NETWORK
or NONE
NETWORK
, WLAN
, USB_ETHERNET
, HNAP_NETWORK
or leave it emptyKnown issues:
After some discussion with @dg8ngn, we'll do some changes to optimize bridge config:
[NETWORK]
nat = yes --> "pre-up iptables -t nat -A POSTROUTING -o usb -j MASQUERADE"
[WLAN]
nat_wlan = yes --> "pre-up iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE"
[USB_ETHERNET]
nat_eth = yes --> "pre-up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE"
[HNAP_NETWORK]
nat_tap = yes --> "pre-up iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE"
Current config.txt default settings:
[NETWORK]
hostname = pluto
ipaddr = 192.168.2.1
netmask = 255.255.255.0
nat =
bridge =
dhcp_server_pool_start = 192.168.2.10
dhcp_server_leasetime = 600
dhcp_server_gateway = 192.168.2.1
dhcp_server_dns = 192.168.2.1
[WLAN]
ssid_wlan =
pwd_wlan =
ipaddr_wlan =
nat_wlan =
bridge_wlan =
[USB_ETHERNET]
ipaddr_eth =
netmask_eth = 255.255.255.0
nat_eth =
bridge_eth =
dhcp_server_pool_start_eth =
dhcp_server_leasetime_eth = 600
dhcp_server_gateway_eth =
dhcp_server_dns_eth =
[HNAP_NETWORK]
ipaddr_tap =
netmask_tap = 255.255.255.240
nat_tap =
bridge_tap =
dhcp_server_pool_start_tap =
dhcp_server_leasetime_tap = 600
dhcp_server_gateway_tap =
dhcp_server_dns_tap =
NETWORK
interface works only with static IP, no DHCP clientipaddr_eth
/ipaddr_tap
are unset, this interface acts as a DHCP clientdhcp_server_pool_start
/dhcp_server_pool_start_eth
/dhcp_server_pool_start_tap
is set, a DHCP server is started on this interfacenat_x
is set to yes
, this interfaces gets a NAT rule in iptablesbr0
, one interface has to be set to bridge_x = master
bridge_x = slave
bridge_x
is neither set to master
or slave
, it will not be affected by bridgingBridging Example:
config.txt:
[NETWORK]
hostname = pluto
ipaddr = 192.168.2.1
netmask = 255.255.255.0
nat =
bridge =
dhcp_server_pool_start = 192.168.2.10
dhcp_server_leasetime = 600
dhcp_server_gateway = 192.168.2.1
dhcp_server_dns = 192.168.2.1
[WLAN]
ssid_wlan =
pwd_wlan =
ipaddr_wlan =
nat_wlan =
bridge_wlan =
[USB_ETHERNET]
ipaddr_eth =
netmask_eth = 255.255.255.0
nat_eth =
bridge_eth = master
dhcp_server_pool_start_eth =
dhcp_server_leasetime_eth = 600
dhcp_server_gateway_eth =
dhcp_server_dns_eth =
[HNAP_NETWORK]
ipaddr_tap =
netmask_tap = 255.255.255.240
nat_tap =
bridge_tap = slave
dhcp_server_pool_start_tap =
dhcp_server_leasetime_tap = 600
dhcp_server_gateway_tap =
dhcp_server_dns_tap =
-> /etc/network/interfaces:
auto lo
iface lo inet loopback
auto usb0
iface usb0 inet static
address 192.168.2.1
netmask 255.255.255.0
auto br0
iface br0 inet dhcp
pre-up tunctl -t tap0
pre-up brctl addbr br0
pre-up brctl addif br0 eth0
pre-up brctl addif br0 tap0
Known issues:
Description
This pull request enables the user to set up the Pluto to work in typical Hamnet network topologies. For this purpose, bridging, NAT and and iptables support have been enabled in the Kernel. For persistent configuration, the network settings are added to the
config.txt
architecture of the Pluto (persistent storage in uboot fw_env)Supported network configurations
Basestation (via USB-Ethernet-Adapter + Lease from HAMNET-Router + Static Route from HAMNET-Router to HNAP-User-Network)
[NETWORK] hostname = master ipaddr = 192.168.2.1 netmask = 255.255.255.0 dhcp_server_first_ip = 192.168.2.10 # or: "ipaddr_host = 192.168.2.10" dhcp_server_leasetime = 600 # 10 minutes lease time dhcp_server_gateway = 192.168.2.1 # Usually "dhcp_server_gateway" equals to "ipaddr" (for me it is OK to type the IP twice)
[USB_ETHERNET] ipaddr_eth = # dhcp-client netmask_eth = 255.255.255.0 # will be ignored, since "ipaddr_eth = " (no value -> DHCP-Client)
[HNAP_NETWORK] ipaddr_tap = 44.128.0.17 # replaces the need for "fw_setenv hnap_tap_ip" netmask_tap = 255.255.255.240 dhcp_server_first_ip_tap = 44.128.0.21 # Starts DHCP-Server starting from .21 (max .30 due to netmask_tap) dhcp_server_leastime_tap = 600 # dhcp_server_gateway_tap = 44.128.0.17 # Configuration file for "udhcpd" reads like this:
start 44.128.0.21
Client (PC via USB + DHCP-Client on HNAP-User-Network + Masquerade packets to HNAP-User-Network)
[NETWORK] hostname = client ipaddr = 192.168.2.1 netmask = 255.255.255.0 dhcp_server_first_ip = 192.168.2.10 # or: "ipaddr_host = 192.168.2.10" dhcp_server_leasetime = 600 # 10 minutes lease time dhcp_server_gateway = 192.168.2.1 # Usually "dhcp_server_gateway" equals to "ipaddr" (for me it is OK to type the IP twice)
[USB_ETHERNET] ipaddr_eth = # dhcp-client netmask_eth = 255.255.255.0 # will be ignored, since "ipaddr_eth = " (no value -> DHCP-Client)
[HNAP_NETWORK] ipaddr_tap = # udhcpc running on "tap0" netmask_tap = 255.255.255.0 # see section [USB_ETHERNET]; I guess it is not required if ipaddr_eth/tap is empty
[NAT] nat_interface = HNAP_NETWORK # translates to "iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE"
Basestation (via USB-Ethernet-Adapter + Bridge USB_ETHERNET / HNAP_NETWORK + Lease from HAMNET-Router)
[BRIDGE] master_interface = USB_ETHERNET slave_interface_1 = HNAP_NETWORK
[NETWORK] hostname = master ipaddr = 192.168.2.1 netmask = 255.255.255.0 dhcp_server_first_ip = 192.168.2.10 # or: "ipaddr_host = 192.168.2.10" dhcp_server_leasetime = 600 # 10 minutes lease time dhcp_server_gateway = 192.168.2.1 # Usually "dhcp_server_gateway" equals to "ipaddr" (for me it is OK to type the IP twice)
[USB_ETHERNET] ipaddr_eth = # dhcp-client netmask_eth = 255.255.255.0 # will be ignored, since "ipaddr_eth = " (no value -> DHCP-Client)
[HNAP_NETWORK] ipaddr_tap = 44.128.0.17 # since HNAP_NETWORK is a "slave_interface" all settings are ignored netmask_tap = 255.255.255.240 # since HNAP_NETWORK is a "slave_interface" all settings are ignored
Basestation (via USB-Ethernet-Adapter + Bridge USB_ETHERNET / HNAP_NETWORK + static IP)
[BRIDGE] master_interface = USB_ETHERNET slave_interface = HNAP_NETWORK
[NETWORK] hostname = master ipaddr = 192.168.2.1 netmask = 255.255.255.0 dhcp_server_first_ip = 192.168.2.10 # or: "ipaddr_host = 192.168.2.10" dhcp_server_leasetime = 600 # 10 minutes lease time dhcp_server_gateway = 192.168.2.1 # Usually "dhcp_server_gateway" equals to "ipaddr" (for me it is OK to type the IP twice)
[USB_ETHERNET] ipaddr_eth = 44.128.0.2 netmask_eth = 255.255.255.240 gateway_eth = 44.128.0.1 # set defaultroute
[HNAP_NETWORK] ipaddr_tap = 44.128.0.17 # since HNAP_NETWORK is a "slave_interface" all settings are ignored netmask_tap = 255.255.255.240 # since HNAP_NETWORK is a "slave_interface" all settings are ignored
Client (Integration into HomeLAN via USB-Ethernet-Adapter + DHCP-Client on HNAP-User-Network + Masquerade packets to HNAP-User-Network)
--> same as "normal client configuration (see first example)
[NETWORK] hostname = client ipaddr = 192.168.2.1 netmask = 255.255.255.0 dhcp_server_first_ip = 192.168.2.10 # or: "ipaddr_host = 192.168.2.10" dhcp_server_leasetime = 600 # 10 minutes lease time dhcp_server_gateway = 192.168.2.1 # Usually "dhcp_server_gateway" equals to "ipaddr" (for me it is OK to type the IP twice)
[USB_ETHERNET] ipaddr_eth = # dhcp-client netmask_eth = 255.255.255.0 # will be ignored, since "ipaddr_eth = " (no value -> DHCP-Client)
[HNAP_NETWORK] ipaddr_tap = # udhcpc running on "tap0" netmask_tap = 255.255.255.0 # see section [USB_ETHERNET]; I guess it is not required if ipaddr_eth/tap is empty
[NAT] nat_interface = HNAP_NETWORK # translates to "iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE"
Client (Integration into HomeLAN via USB-Ethernet-Adapter to Mikrotik-Router + Bridge USB_ETHERNET / HNAP_NETWORK + DHCP-Client on HNAP-User-Network)
[BRIDGE] master_interface = USB_ETHERNET slave_interface_1 = HNAP_NETWORK
[NETWORK] hostname = client ipaddr = 192.168.2.1 netmask = 255.255.255.0 dhcp_server_first_ip = 192.168.2.10 # or: "ipaddr_host = 192.168.2.10" dhcp_server_leasetime = 600 # 10 minutes lease time dhcp_server_gateway = 192.168.2.1 # Usually "dhcp_server_gateway" equals to "ipaddr" (for me it is OK to type the IP twice)
[USB_ETHERNET] ipaddr_eth = # udhcpc running on Bridge (master_interface) netmask_eth = 255.255.255.0
[HNAP_NETWORK] ipaddr_tap = # nothing - slave client netmask_tap = 255.255.255.0 #