documentation:examples:dhcp_relay_and_server_lab
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | documentation:examples:dhcp_relay_and_server_lab [2017/07/10 14:20] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== DHCP Relay and Server lab ====== | ||
| + | This Labs show an example of IPv4 DHCP Relay and server with BSDRP (v1.51) | ||
| + | |||
| + | ===== Presentation ===== | ||
| + | |||
| + | ==== Network diagram ==== | ||
| + | |||
| + | Here is the logical and physical view: | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===== Setting-up the lab ===== | ||
| + | |||
| + | ==== Downloading BSD Router Project images ==== | ||
| + | |||
| + | Download a BSDRP serial image (prevent to have to use an X display) on SourceForge. | ||
| + | |||
| + | ==== Downloading BSDRP lab scripts and starting the lab ===== | ||
| + | |||
| + | More information on these BSDRP lab scripts available on [[documentation: | ||
| + | |||
| + | Start a lab with 3 routers full meshed (no common LAN), example with VirtualBox script: | ||
| + | < | ||
| + | # tools/ | ||
| + | BSD Router Project (http:// | ||
| + | Setting-up a virtual lab with 3 VM(s): | ||
| + | - Working directory: /tmp/BSDRP | ||
| + | - Each VM have 1 core(s) and 256M RAM | ||
| + | - Emulated NIC: virtio-net | ||
| + | - Switch mode: bridge + tap | ||
| + | - 0 LAN(s) between all VM | ||
| + | - Full mesh Ethernet links between each VM | ||
| + | VM 1 have the following NIC: | ||
| + | - vtnet0 connected to VM 2 | ||
| + | - vtnet1 connected to VM 3 | ||
| + | VM 2 have the following NIC: | ||
| + | - vtnet0 connected to VM 1 | ||
| + | - vtnet1 connected to VM 3 | ||
| + | VM 3 have the following NIC: | ||
| + | - vtnet0 connected to VM 1 | ||
| + | - vtnet1 connected to VM 2 | ||
| + | For connecting to VM' | ||
| + | - VM 1 : cu -l /dev/nmdm1B | ||
| + | - VM 2 : cu -l /dev/nmdm2B | ||
| + | - VM 3 : cu -l /dev/nmdm3B | ||
| + | </ | ||
| + | ===== Routers configuration ===== | ||
| + | |||
| + | ==== VM3 (DHCP server) ==== | ||
| + | |||
| + | < | ||
| + | sysrc hostname=VM3 | ||
| + | sysrc gateway_enable=NO | ||
| + | sysrc ipv6_gateway_enable=NO | ||
| + | sysrc ifconfig_em1=" | ||
| + | sysrc defaultrouter=" | ||
| + | sysrc dhcpd_enable=YES | ||
| + | sysrc dhcpd_flags=" | ||
| + | sysrc dhcpd_conf="/ | ||
| + | sysrc dhcpd_ifaces=" | ||
| + | sed -i "" | ||
| + | cat > / | ||
| + | subnet 10.0.23.0 netmask 255.255.255.0 { | ||
| + | } | ||
| + | subnet 10.0.12.0 netmask 255.255.255.0 { | ||
| + | range 10.0.12.100 10.0.12.200; | ||
| + | option routers 10.0.12.2; | ||
| + | } | ||
| + | ' | ||
| + | |||
| + | hostname VM3 | ||
| + | service netif restart | ||
| + | service routing restart | ||
| + | service isc-dhcpd start | ||
| + | config save | ||
| + | </ | ||
| + | ==== VM2 (Router and DHCP Relay) ==== | ||
| + | |||
| + | < | ||
| + | sysrc hostname=VM2 | ||
| + | sysrc ifconfig_em0=" | ||
| + | sysrc ifconfig_em1=" | ||
| + | sysrc dhcprelya_enable=YES | ||
| + | sysrc dhcprelya_servers=" | ||
| + | sysrc dhcprelya_ifaces=" | ||
| + | sed -i "" | ||
| + | hostname VM2 | ||
| + | service netif restart | ||
| + | service routing restart | ||
| + | service dhcprelya start | ||
| + | config save | ||
| + | </ | ||
| + | |||
| + | ==== VM1 (DHCP client) ==== | ||
| + | |||
| + | < | ||
| + | sysrc hostname=VM1 | ||
| + | sysrc ifconfig_em0=" | ||
| + | sysrc gateway_enable=NO | ||
| + | sysrc ipv6_gateway_enable=NO | ||
| + | sed -i "" | ||
| + | hostname VM1 | ||
| + | service netif restart | ||
| + | service routing restart | ||
| + | config save | ||
| + | </ | ||
| + | |||
| + | ===== Final testing ===== | ||
| + | |||
| + | Check data received by DHCP client on VM1: | ||
| + | < | ||
| + | [root@VM1]~# | ||
| + | vtnet0: flags=8943< | ||
| + | options=80028< | ||
| + | ether 58: | ||
| + | hwaddr 58: | ||
| + | inet6 fe80:: | ||
| + | inet 10.0.12.100 netmask 0xffffff00 broadcast 10.0.12.255 | ||
| + | nd6 options=21< | ||
| + | media: Ethernet 10Gbase-T < | ||
| + | status: active | ||
| + | [root@VM1]~# | ||
| + | lease { | ||
| + | interface " | ||
| + | fixed-address 10.0.12.100; | ||
| + | option subnet-mask 255.255.255.0; | ||
| + | option routers 10.0.12.2; | ||
| + | option dhcp-lease-time 43200; | ||
| + | option dhcp-message-type 5; | ||
| + | option dhcp-server-identifier 10.0.23.3; | ||
| + | renew 1 2017/7/10 20:14:07; | ||
| + | rebind 2 2017/7/11 00:44:07; | ||
| + | expire 2 2017/7/11 02:14:07; | ||
| + | } | ||
| + | </ | ||
documentation/examples/dhcp_relay_and_server_lab.txt · Last modified: 2017/07/10 14:20 by 127.0.0.1
