This article explains how to add a custom 2nd NIC to a Lighthouse instance.
On VMware/ESX make use same Network Adapter type eg both vmxnet3
- In the Hypervisor configuration, add a 2nd network interface, and bind it to the required external network
- Reboot Lighthouse, and verify that net2 is now visible
root@lighthouse:~# ifconfig net2
net2 Link encap:Ethernet HWaddr 52:54:00:8c:38:73
inet6 addr: fe80::5054:ff:fe8c:3873/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:888 errors:0 dropped:0 overruns:0 frame:0 TX packets:506 errors:0 dropped:0 overruns:0 carrier:0 collisions:2266 txqueuelen:1000
RX bytes:87554 (85.5 KiB) TX bytes:3025355 (2.8 MiB) - Create /etc/config/conman.d/net2.conf and add custom connection for DHCP or Static IP address net2 interface.
If you are not familiar with using vi editor use the following command, paste the config and press CTRL-D which saves the file.
cat > /etc/config/conman.d/net2.conf
# Custom Conns for 2nd interface if you want DHCP
conn network-services-conn-init_net2
var ifname net2
start ip addr flush dev %ifname%
start ip link set dev %ifname% up
start mii-tool --restart %ifname%
start sleep 2
start ifconfig %ifname% up
start sleep 2
start bash -c "infod_client -o push -p %ifname%.link_local -d $( ifconfig %ifname% | grep fe80 | sed -r 's/.*(fe80::[^ ]+).*/\1/' )"
stop ifconfig %ifname% down
conn network-services-conn
parent network-services-conn-init_net2
start infod_client -o push -p udhcpc.%ifname%.status -d down
up expect-return none bash -c "/sbin/udhcpc --syslog --release --now --interface %ifname% --foreground --script '/usr/share/udhcpc/default.script' --conn_uuid 'lighthouse_configurations_system_net_conns-2' --request-option 43 --vendorclass 'Opengear/Lighthouse' -x hostname:`hostname` -O staticroutes msstaticroutes --retries 3 --pidfile /var/run/udhcpc.%ifname%.pid"
stop ifconfig %ifname%:dhcp 0.0.0.0
stop infod_client -o delete -p udhcpc.%ifname%
stop infod_client -o push -p udhcpc.%ifname%.status -d down
test infod-equals udhcpc.%ifname%.status up
testperiod 15
testthreshold 20
testthreshold 5
# Custom Conns for 2nd interface if you want a Static IP
conn network-services-conn-init_net2
var ifname net2
start ip addr flush dev %ifname%
start ip link set dev %ifname% up
start mii-tool --restart %ifname%
start sleep 2
start ifconfig %ifname% up
start sleep 2
start bash -c "infod_client -o push -p %ifname%.link_local -d $(ifconfig %ifname% | grep fe80 | sed -r 's/.*(fe80::[^ ]+).*/\1/' )"
stop ifconfig %ifname% down
conn network-services-conn
parent network-services-conn-init_net2
start ip addr add 192.168.1.2/255.255.255.0 broadcast 192.168.1.255 dev %ifname% label %ifname%:static1
start ip route add default via 192.168.1.1 dev net2:static1
stop ip route del default via 192.168.1.1 dev net2:static1
stop ip addr del 192.168.1.2/255.255.255.0 dev %ifname% - Restart conman to bring up the 2nd interface, then validate that net2 has an address
root@lighthouse:~# pkill -HUP conman
... Wait 30 seconds
# If you have used DHCP
root@lighthouse:~# ifconfig net2:dhcp
net2:dhcp Link encap:Ethernet HWaddr 52:54:00:8c:38:73
inet addr:192.168.82.39 Bcast:192.168.82.255
Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:root@lighthouse:~#
#if you have used Static
root@lighthouse:~# ifconfig net2:static1
net2:static1 Link encap:Ethernet HWaddr 52:54:00:8c:38:73
inet addr:192.168.82.39 Bcast:192.168.82.255
Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric: - Add a firewall rule to allow relevant incoming traffic on net2. If /etc/config/scripts/firewall-post does not exist, create the subdirectory
root@lighthouse:~# mkdir -p /etc/config/scripts/
- Add this line after any existing rules
echo "iptables -I INPUT -i net2 -j WanInput" >> /etc/config/scripts/firewall-post
- Make sure the file is marked with execute permissions
chmod +x /etc/config/scripts/firewall-post
- Force the firewall configurator to run to install the new firewall rule
root@lighthouse:~# configurator_firewall --force
- Verify you can access the device via the IP of net2.
- Run configurator_local_network and retest connectivity to verify that the changes will survive system configuration changes.
root@lighthouse:~# configurator_local_network root@lighthouse:~# ifconfig net2:dhcp net2:dhcp Link encap:Ethernet HWaddr 52:54:00:8c:38:73 inet addr:192.168.82.39 Bcast:192.168.82.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric
Comments
0 comments
Article is closed for comments.