Configurando interface vlan usando iproute2 no linux

Vamos identificar a interface de rede que deverá receber uma interface vlan .

ip show addr

3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether a4:1f:72:f5:81:1f brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.10/24 scope global enp4s0
       valid_lft forever preferred_lft forever

Vamos criar a interface vlan

ip link add link enp4s0 name enp4s0.110 type vlan id 110 
julio@julio:~$ ip -d link show enp4s0.110
14: enp4s0.110@enp4s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether a4:1f:72:f5:81:1f brd ff:ff:ff:ff:ff:ff promiscuity 0 
    vlan protocol 802.1Q id 110 <REORDER_HDR> addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 

Adicionar o endereço de rede

ip addr add 192.168.110.100/24 brd 192.168.110.255 dev enp4s0.110

Subir a interface.

ip link set dev enp4s0.110 up

Listar as interfaces.

ip addr show

julio@julio-OptiPlex-3010:~$ ip addr show
14: enp4s0.110@enp4s0:  mtu 1500 qdisc noqueue state UP group default qlen 1000<br>
    link/ether a4:1f:72:f5:81:1f brd ff:ff:ff:ff:ff:ff<br>
    inet 192.168.110.100/24 brd 192.168.26.255 scope global enp4s0.110<br>
       valid_lft forever preferred_lft forever<br>
    inet6 fe80::a61f:72ff:fef5:811f/64 scope link <br>
       valid_lft forever preferred_lft forever



Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *