Abaixo o layout de rede utilizado neste laboratório:
Configurações Efetuadas no RO-Linux:
~# ifconfig eth0 10.25.25.5/29
Pré-Requisitos:
~# modprobe 8021q
~# apt-get install vlan
Criação de VLANs no Linux:
~# vconfig add eth0 10
~# vconfig add eth0 20
~# ifconfig eth0.10 192.168.10.1/24 mtu 1496
~# ifconfig eth0.20 192.168.20.1/24 mtu 1496
Somos um Roteador afinal:
echo 1 > /proc/sys/net/ipv4/ip_forward
DHCP para as VLANs:
~# apt-get install dhcp3-server
~# cat /etc/dhcp3/dhcpd.conf
ddns-update-style none;
option domain-name "syn.local";
option domain-name-servers 10.10.10.1, 10.10.10.2;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
# VLAN-10
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.2 192.168.10.10;
option domain-name-servers 10.10.10.1;
option domain-name "syn.local";
option routers 192.168.10.1;
option broadcast-address 192.168.10.255;
default-lease-time 600;
max-lease-time 7200;
}
# VLAN-20
subnet 192.168.20.0 netmask 255.255.255.0 {
range 192.168.20.2 192.168.20.10;
option domain-name-servers 10.10.10.1;
option domain-name "syn.local";
option routers 192.168.20.1;
option broadcast-address 192.168.20.255;
default-lease-time 600;
max-lease-time 7200;
~# apt-get install dhcp3-server
~# cat /etc/dhcp3/dhcpd.conf
ddns-update-style none;
option domain-name "syn.local";
option domain-name-servers 10.10.10.1, 10.10.10.2;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
# VLAN-10
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.2 192.168.10.10;
option domain-name-servers 10.10.10.1;
option domain-name "syn.local";
option routers 192.168.10.1;
option broadcast-address 192.168.10.255;
default-lease-time 600;
max-lease-time 7200;
}
# VLAN-20
subnet 192.168.20.0 netmask 255.255.255.0 {
range 192.168.20.2 192.168.20.10;
option domain-name-servers 10.10.10.1;
option domain-name "syn.local";
option routers 192.168.20.1;
option broadcast-address 192.168.20.255;
default-lease-time 600;
max-lease-time 7200;
~# cat /etc/default/dhcp3-server
INTERFACES="eth0.10 eth0.20"
~# /etc/init.d/dhcp3-server start
INFO sobre as VLANs:
~# cat /proc/net/vlan/config
~# cat /proc/net/vlan/eth0.XX
Configurações efetuadas no SW Cisco:
sw# conf t
sw(config)# int f1/1
sw(config-if) # desc SW <-> RO-Linux
sw(config-if)# switchport mode trunk
sw(config-if)# switchport trunk encap dot1q
sw(config-if)# int f1/2
sw(config-if)# switchport mode access
sw(config-if)# switchport access vlan 10
sw(config-if)# int f1/3
sw(config-if)# switchport mode access
sw(config-if)# switchport access vlan 20
Segue Meu Dynagen para facilitar:
~# cat vlan-lab.net
autostart = False
ghostios = True
sparsemem = True
[localhost:7200]
workingdir = /tmp
[[Router SW]]
image = /ios/c3X00/c3725-mz.124-15.t5.image
model = 3725
ram = 148
disk0 = 8
disk1 = 0
slot1 = NM-16ESW
f1/1 = NIO_linux_eth:eth0
f1/2 = NIO_udp:30000:127.0.0.1:20000
f1/3 = NIO_udp:30001:127.0.0.1:20001
idlepc = 0x60bf1f5c
ghostios = True
sparsemem = True
[localhost:7200]
workingdir = /tmp
[[Router SW]]
image = /ios/c3X00/c3725-mz.124-15.t5.image
model = 3725
ram = 148
disk0 = 8
disk1 = 0
slot1 = NM-16ESW
f1/1 = NIO_linux_eth:eth0
f1/2 = NIO_udp:30000:127.0.0.1:20000
f1/3 = NIO_udp:30001:127.0.0.1:20001
idlepc = 0x60bf1f5c
~# cat startup.vpc
# 1- pc1, 2- pc2
1
dhcp
2
dhcp
1
1
dhcp
2
dhcp
1
Depois das configurações, apenas faça:
~# ./vpcs
Os PCS deverão pegar os ips do RO-Linux atráves doServidor DHCP. Claro, para os hosts chegarem até ainternet é preciso configurar o NAT no RO-Linux. Algoassim:
iptables -t nat -A POSTROUTING -o $WAN-IF -j SNAT --to $WAN-IP
Obviamente este lab está longe de estar completo,mas não deixa de ser um bom ponto de partida.
Help:
biOos
No comments:
Post a Comment