Replace ens160 with the connection name. “vmcli con show”
sudo nmcli connection mod ens160 ipv4.method auto
Should be able to restart the networking service or reboot the server
Replace ens160 with the connection name. “vmcli con show”
sudo nmcli connection mod ens160 ipv4.method auto
Should be able to restart the networking service or reboot the server
https://wiki.mikrotik.com/wiki/Manual:Interface/VLAN
VLAN successfully passes through regular Ethernet bridges
https://wiki.mikrotik.com/wiki/Manual:Basic_VLAN_switching
https://wiki.mikrotik.com/wiki/Manual:Layer2_misconfiguration
DHCP offering lease without success issue with Mikrotik on the far side of Ubiquiti device.
Make sure that radio does not have the VLAN configured on just the WAN interface. Easiest way would be to put it in bridge mode and use the management VLAN.
The UniFi cameras are different then the AirMax line in how the configuration works. There is a “/tmp/system.cfg” file, but it does not contain most of the configuration option. In the default directory there are some files which appear to handle the device configuration.
The network configuration file is “ubnt_networkd.conf”
Edit the file by opening it up in vi or a different text editor.
{ "cfgver": 2, "dhcp": { "fallbackIP": "192.168.1.20", "fallbackNetmask": "255.255.255.0", "status": 0 <-- 0=Static 1=DHCP }, "dns": { "ns1": { "ip": "8.8.8.8", "status": 1 }, "ns2": { "ip": "4.2.2.2", "status": 1 } }, "routes": { "gateway": "192.168.5.1" }, "statik": { "ip": "192.168.5.11", "netmask": "255.255.255.0" } }
If you want to set the static address, you should be able to edit the settings in this config and leave DHCP status disabled.
To set the Camera to use DHCP, under dhcp change “”status”: 0″ to “”status”: 1″
{ "cfgver": 2, "dhcp": { "fallbackIP": "192.168.1.20", "fallbackNetmask": "255.255.255.0", "status": 1 }, "dns": { "ns1": { "ip": "8.8.8.8", "status": 1 }, "ns2": { "ip": "4.2.2.2", "status": 1 } }, "routes": { "gateway": "192.168.5.1" }, "statik": { "ip": "192.168.5.11", "netmask": "255.255.255.0" } }
After the settings are applied the camera will use use DHCP regardless of the statik ip settings.
Use the following command to write the changes to persistent storage
ubnt_cmd_persist.sh
And reboot the camera.
reboot
Camera should pull a DHCP address when it boots up
Edit the “/tmp/system.cfg”
Change the line that contains “dhcpc.status=disabled” to
dhcpc.status=enabled
add the following lines
dhcpc.1.devname=br0 dhcpc.1.fallback=192.168.1.20 dhcpc.1.fallback_netmask=255.255.255.0 dhcpc.1.status=enabled
Save and exit and save changes
/usr/etc/rc.d/rc.softrestart save
Log into the GUI and verify everything looks correct. Under the network tab it was still showing that it had a static address, although it pulled a DHCP IP.
In Linux you can send signals to a process id to trigger actions for the program. Useful scenario for this is to renew an IP address on a device that uses udhcpc. You should be able to change udhcpc for other programs, you’ll just need to read the help for that specific program.
In the udhcpc help it says
Signals: USR1 Renew lease USR2 Release lease
But how do we send those signals to udhcpc? Answer, use the kill command.
kill: kill [-s sigspec | -n signum | -sigspec] pid | jobspec … or kill -l [sigspec] Send a signal to a job.Send the processes identified by PID or JOBSPEC the signal named by SIGSPEC or SIGNUM. If neither SIGSPEC nor SIGNUM is present, then SIGTERM is assumed.
Options:
-s sig SIG is a signal name
-n sig SIG is a signal number
-l list the signal names; if arguments follow `-l' they are
assumed to be signal numbers for which names should be listed
-L synonym for -l
Kill is a shell builtin for two reasons: it allows job IDs to be used
instead of process IDs, and allows processes to be killed if the limit on processes that you can create is reached
.Exit Status:
Returns success unless an invalid option is given or an error occurs.
We see from above that we can pass a signal name in using the -s option.
So to send USR1 signal to udhcp we do the following
kill -s USR1 pid_of_udhcpc
Replace pid_of_udhcpc with the actual pid or use the following command to find the pid
kill -s USR1 $(pgrep udhcpc)
“pgrep udhcpc” prints the pid of the searched for process.
Helpful links
https://www.thegeekstuff.com/2011/02/send-signal-to-process/
https://www.linux.org/threads/kill-signals-and-commands-revised.11625/
AirOS uses udhcpc for the DHCP client on Ubiquiti Radios. To renew the DHCP address you can kill the udhcpc process and it’ll automatically restart and get a new address.
Renew DHCP lease
Kill udhcpc with the following command.
killall udhcpc
Other info
Print info about the DHCP lease. May need to change “info.br1” to “info.eth0” or some other interface.
cat /etc/udhcpc/info.eth0
Example output.
XW.v6.2.0# cat /etc/udhcpc/info.br1 u_interface="br1" u_broadcast="" u_subnet="255.255.255.0" u_ip="10.93.0.10" u_router="10.93.0.1" u_dns="8.8.8.8 1.1.1.1" u_hostname="" u_serverid="10.93.0.1" u_domain="" u_leasetime=600 u_timestamp="1143249941" u_started=1142593 u_pid=936 XW.v6.2.0#
Command arguments that udhcp is run with. Info was collected by running the “ps | grep udhcp” command. Note that the interface “eth0” can be different if the device is in bridge mode.
/sbin/udhcpc -f -i eth0 -s /etc/udhcpc/udhcpc -p /var/run/udhcpc.eth0.pid -h device_name
udhcpc help output
XW.v6.2.0# udhcpc --help BusyBox v1.24.2 (2019-07-03 11:13:35 EEST) multi-call binary. Usage: udhcpc [-fbqvRB] [-t N] [-T SEC] [-A SEC/-n] [-i IFACE] [-s PROG] [-p PIDFILE] [-oC] [-r IP] [-V VENDOR] [-F NAME] [-x OPT:VAL]... [-O OPT]... -i,--interface IFACE Interface to use (default eth0) -s,--script PROG Run PROG at DHCP events (default /usr/share/udhcpc/default.script) -p,--pidfile FILE Create pidfile -B,--broadcast Request broadcast replies -t,--retries N Send up to N discover packets (default 3) -T,--timeout SEC Pause between packets (default 3) -A,--tryagain SEC Wait if lease is not obtained (default 20) -n,--now Exit if lease is not obtained -q,--quit Exit after obtaining lease -R,--release Release IP on exit -f,--foreground Run in foreground -b,--background Background if lease is not obtained -S,--syslog Log to syslog too -r,--request IP Request this IP address -o,--no-default-options Don't request any options (unless -O is given) -O,--request-option OPT Request option OPT from server (cumulative) -x OPT:VAL Include option OPT in sent packets (cumulative) Examples of string, numeric, and hex byte opts: -x hostname:bbox - option 12 -x lease:3600 - option 51 (lease time) -x 0x3d:0100BEEFC0FFEE - option 61 (client id) -F,--fqdn NAME Ask server to update DNS mapping for NAME -V,--vendorclass VENDOR Vendor identifier (default 'udhcp VERSION') -C,--clientid-none Don't send MAC as client identifier -v Verbose Signals: USR1 Renew lease USR2 Release lease XW.v6.2.0#
Note that you can also send a signal to the PID of udhcpc and have it renew the address. To do that use the following command, replacing pidofudhcpc to pid of udhcp.
kill -s USR1 pidofudhcpc
or use the following command to find the pid for you.
kill -s SIGUSR1 $(pgrep udhcpc)
Gain access to radio via ssh
ssh ubnt@192.168.1.20
open up the /tmp/system.cfg
vi /tmp/system.cfg
Delete the following line. To move the cursor to the following line and type “dd” and vi will delete the whole line.
dhcpc.status=disabled
Add the following 5 lines. Hit “i” to enter vi insert mode.
br0 should be correct interface in most scenarios.
dhcpc.1.devname=br0
dhcpc.1.fallback=192.168.1.20
dhcpc.1.fallback_netmask=255.255.255.0
dhcpc.1.status=enabled
dhcpc.status=enabled
Save the file by hitting esc and then “:wq” followed by Return/Enter
Save the config changes and reboot the radio so it pulls an address.
/usr/etc/rc.d/rc.softrestart save && reboot
Install dhcp server software
sudo apt install isc-dhcp-server
Edit the following config file and set the networking interface it should use. In this case enp60s0
sudo vi /etc/default/isc-dhcp-server
Example line to change
INTERFACESv4="enp60s0"
Now edit the dhcpd.con file
sudo vi /etc/dhcp/dhcpd.conf
Add the following in. Change the addresses and settings as needed.
subnet 192.168.47.0 netmask 255.255.255.0 { range 192.168.47.26 192.168.47.30; option domain-name-servers ns1.internal.example.org; option domain-name "internal.example.org"; option subnet-mask 255.255.255.0; option routers 192.168.47.1; option broadcast-address 192.168.47.255; default-lease-time 600; max-lease-time 7200; }
Set a static ip on the computer that’ll be acting as the dhcp server. You can set it as the gateway if it is the gateway.
Allow dhcp through the firewall
sudo ufw allow 67/udp sudo ufw reload
Restart the service and connect a client.
sudo systemctl restart isc-dhcp-server
You can look at dhcp leases with the following command
tail -f /var/lib/dhcp/dhcpd.leases