But i want have sansung in default network… I try connect to this network from HASSOS from settings>network>interface WLP2S0 and type static IP, mask, and no gateway, and set DSN and can not save it. Now gateway is a problem.
yes in ubiquiti default VLAN is 1
https://community.ui.com/questions/VLAN-ID-for-the-Default-Network/927ba6e1-68b5-42aa-a257-7b27011cbc19
ok i created but probably wrong. It show in HASSOS but how connect it ? It is WLP2S0.1
WLP2S0 is default added and it is my card wifi in terminal.
How i can remove inteface from command line SSH ?
And how i can copy command from this terminal addon to show you ?
Not knowing your system, I would say you created the VLAN attached to the wireless interface as a parent device and not to cabled interface, as it should.
How to use nmcli in terminal, to add and delete devices, you can consult the manual:
https://manpages.ubuntu.com/manpages/jammy/man1/nmcli.1.html
OK but i dont know how i must create as you write me…
I want use this wificard WLP2S0 to connect it to wifi VLAN1 where is Samsung TV. But i can no create connection without defined GATEWAY. Home Assistant can not do it.
This is something I have not tried, so I can’t help.
Try reading this to understand how to configure and use wifi on HA:
but if i connect next interface LAN RJ45 by USB to my HP Terminal i can configure it with this command line ? And whet command type to configure it withou gateway as you write me ?
And i see that i must set gateway ? But you write that no set gawteway…
(I will at some point review the tutorial to update it)
Why would you want to add a third interface? Like I told you before, stick to cable rj45 whenever possible.
If nmcli does not allow you to create an interface without a gateway, just make sure that the default gateway is the one interface you want, in your case, that would be enp1s0, as far as I could see from your screenshot.
You can do the following to any other interface (I use in the example your new vlan1 created in the cabled interface enp1s0.1, using nmcli
#nmcli con add type vlan con-name enp1s0@vlan1 dev enp1s0 id 1 ip4 192.168.4.x/24 ipv4.dns 192.168.4.1 gw4 192.168.4.1
#nmcli con modify enp1s0@vlan1 ipv4.never-default yes
This should be enough.
This is a more up-to-date version of this older first tutorial, taking into account that HA has changed a little bit. Starting from version 11, the UI already supports VLAN configuration in the menu Settings > System > Network, so these old tutorials will only be left here available, to others looking for different options.
VLAN in HA:
- Install and configure (according to documentation) the “Home Assistant Community Add-on: SSH & Web Terminal” add-on in System > Add-ons
- Open the terminal and confirm you are the root user
~ whoami
root
-
From here you will use the
nmcli
configuration tool.
#nmcli connection show
will list the connections available, its UUIDs, types and devices. -
Create the VLAN interface with a static address choosing whichever network physical interface (parent interface) you want the VLAN to traverse (in this example, we use eth0, but it might change depending on your setup), by defining the VLAN’s connection name, id, ip, gateway and dns (adjust the numbers to your network and needs), as in the example below:
#nmcli con add type vlan con-name eth0@vlan10 dev eth0 id 10 ip4 10.0.0.2/8 ipv4.dns 10.0.0.1 gw4 10.0.0.1
Let’s break down this last command:
“nmcli con add” - Add a new connection
“type vlan” - a vlan type interface
“con-name eth0@vlan10” - the name of the new VLAN interface
“dev eth0” - the parent device where the VLAN will attach
“id 10” - the vlan id number
“ip4 10.0.0.2/8” - ip and netmask of the VLAN interface
“ipv4.dns 10.0.0.1” - dns server of the VLAN interface
“gw4 10.0.0.1” - gateway of the VLAN interface
More information here:
and here:
- Show connections again and it should list your new VLAN (fake uuids)
#nmcli connection show
NAME UUID TYPE DEVICE
eth0 aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa ethernet eth0
eth0@vlan10 bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb vlan eth0.10
-
To see more detailed info about the connection
#nmcli -p con show eth0@vlan10
-
To force all HA generated traffic through the “normal”/more private route and avoid some problems caused by having now two default gateways, there are three possible solutions:
a) first is that you can change/set the gateways’ priorities/metric values in each interface so that traffic first chooses the interface you want (by default, network manager sets ethernet as 100 and vlan as 400). If you use only tagged VLANs and remove the physical network interface ip configuration, it could be important to choose which VLAN carries default network traffic from HA. You can set priorities like this:
#nmcli con modify eth0@vlan10 ipv4.route-metric value
The lower the value, the higher will be the priority for the interface.
#nmcli con modify eth0@vlan1 ipv4.route-metric 400
#nmcli con modify eth0@vlan10 ipv4.route-metric 401
would give priority to vlan1 as a default gateway for internet access.
b) second is to disable/block default routing altogether in the unwanted device(s), so that each interface only uses its assigned network:
#nmcli con modify eth0@vlan10 ipv4.never-default yes
would disable default routing through this VLAN interface.
c) third option is to remove the gateway from the interface by setting the gateway as empty (note the empty value between the ticks):
#nmcli con mod eth0@vlan10 ipv4.gateway ''
More information here:
-
Repeat steps 4 to 7 to create additional VLANS, adjusting network settings
-
Now enter the nmcli editor to “edit” your connection
#nmcli con edit eth0@vlan10
-
Just save the settings and properties and it should report a successful update to the connection
#nmcli> save
-
To double-check settings of the vlan interface
#nmcli> print ipv4
-
Quit the nmcli editor
#nmcli> quit
(depending on the type of HA installation, your files might not be visible at all! That is ok, and you can proceed to 15, if nmcli is listing the connections.)
-
Check for the creation of a new file(s) with VLAN(s) definitions (there should be an eth0@vlan10 file and one for each new VLAN created)
#ls -la /etc/NetworkManager/system-connections/
-
(optionally) Check the contents of the file (possible output below)
#cat /etc/NetworkManager/system-connections/eth0@vlan10
[connection]
id=eth0@vlan10
uuid=bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
type=vlan
permissions=
timestamp=1546212011
[ethernet]
mac-address-blacklist=
[vlan]
egress-priority-map=
flags=1
id=10
ingress-priority-map=
parent=eth0
[ipv4]
address1=10.0.0.2/8,10.0.0.1
dns=10.0.0.1;
dns-search=
method=manual
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto
- Exit the session and reboot the HA host to test (after rebooting you can login to HA again like in 1st step and see if file with definitions still exists)
My terminal HP has LAN enp1s0 and WIFI wlp2s0. Now i have connected my terminal w Home Assistant by LAN (enp1s0) to VLAN 10(192.168.10.x)
How i can do this as you write to connecte VLAN 1 (192.168.4.x) where is connected Samsung TV ?
When LAN (enp1s0) i connect to VLAN 1 it was removed from VLAN 10. Yes ?
What you are saying is that you have VLAN10 as pvid (port default vlan id) set in Ubuquiti switch where HA cable connects to, right? So now you have to enable VLAN1 tagged to that same port, configure VLAN1 tagged in HA as per the tutorial and you should be able to reach 192.168.4.0 network directly from HA. Configuration of the Ubiquiti switch should be easy for you
Ok. But i can enable on the same interface in HA next VLAN ID ?And interface in HA will be has on the same phisical interface VLAN 10 and VLAN1 ?
Yes. VLANs are separate logical networks that can be configured to use the same physical interface and cable. In order for that separation to happen, you need to use tagging, so that the switch and network interfaces can recognize that these are different LANs (VLANS).
Each physical cable can carry one untagged VLAN (pvid) and multiple tagged VLANS (depending on switch capabilities).
You can set a pvid (in your case, I guess the default untagged VLAN in this switch port is 10) and then you can enable many other tagged VLANS that will travel through the same cable/interface.
I am not a network specialist, so maybe some reading could help you clear these concepts
Default on my Ubiquiti is VLAN1 and it is with Samsung. HA is in VLAN10.
On ubiquiti on port in switch i can setup ALL or select specied network VLAN.
In this i think that i must setup ALL.
In every managed switch (with vlan capabilities) there is a pvid for all ports that comes by default from factory. Usually this is vlan id 1. If your HA is on a different vlan (10) that means that you (or someone) had to create the vlan id 10 and change the pvid of that port where HA connects to 10 too. You’ll have to go to this same configuration and add vlan 1 as a tagged vlan in this port.
Yes i create VLAN 10. But i also has default VLAN1 and it is network where is Samsung TV 192.168.4.x
Network where is HA is VLAN 10 (192.168.10.x)
I understand, let’s sum up the current state and what you have to do.
Done:
- Default pvid as VLAN1 is factory default for all ports
- Default port pvid where you connect HA cable is VLAN10.
To do:
- Add tagged VLAN1 to HA (follow tutorial in this thread)
- Add tagged VLAN1 to Ubiquiti port where HA connects (check the manual for your switch)
ok o try and test, and tell me how show actual metric for interface which is now set ?
In terminal:
ip -4 route
it should show the metric for each routing entry.
but maybe from command line i can add this interface with vlan but without GATEWAY ?
Now i add with gateway. Is any command to delete for this interface gateway ?