make vlan in linux

firstly install package vlan  

hafiz-sky1 ~ # apt-get install vlan

using command vconfig to make vlan in linux
for add vlan
vconfig add [interface-name] [vlan_id]
for removing vlan
vconfig  rem [interface-name]

exp.

hafiz-sky1 ~ # vconfig add eth0 224
Added VLAN with VID == 224 to IF -:eth0:-

success to make a vlan id

hafiz-sky1 ~ # ifconfig eth0.224

eth0.224  Link encap:Ethernet  HWaddr 88:ae:1d:cc:22:7b 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


adding IPaddress in vlan

hafiz-sky1 ~ # ifconfig eth0.224 10.0.0.16/8

explanation:
eth0.224 is interfaces of vlan
ipaddress 10.0.0.16 with netmask 255.0.0.0 

hafiz-sky1 ~ # ifconfig eth0.224
eth0.224  Link encap:Ethernet  HWaddr 88:ae:1d:cc:22:7b 
          inet addr:10.0.0.16  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::8aae:1dff:fecc:227b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:6922 (6.9 KB)

to remove vlan
hafiz-sky1 ~ # vconfig rem eth0.224
Removed VLAN -:eth0.224:-

Kalau di RedHat Base, tambahkan dua baris pada script interface network
DEVICE=eth0.224
VLAN=yes

jika ingin dihapus maka hanya perlu menghapus script tersebut.

No comments:

Post a Comment