eve-ng giving internet access to labs via nat

used eve-ng community version.

  • find you eve-ng access interface : ip addr will show the your link address. I have used 172.18.XXX for eve-ng access.

ip addr | grep 172.18
inet 172.18.1.113/16 brd 172.18.255.255 scope global pent

  • find DHCP enables interface and your DHCP configurationĀ :

more /etc/default/isc-dhcp-server : will show you dhcp enabled interface. Generally pnet9 is enabled eve-ng community version.

more /etc/dhcp/dhcpd.conf

You will see a single subnet used for DHCP assignment. The interface network which dhcp is enabled, should be used in here.

subnet 172.16.222.0 netmask 255.255.255.0 {
range 172.16.222.101 172.16.222.199;
option domain-name-servers 8.8.8.8, 4.4.4.4;
option domain-name “lab-int”;
option subnet-mask 255.255.255.0;
option routers 172.16.222.1; # dhcp enabled pnet9 address.
default-lease-time 604800;
max-lease-time -1;
}

  • add ip nat rule for packets going out toward, in my case this is pnet0

iptables -t nat -A POSTROUTING -o pnet0 -s 172.16.222.0/24 -j MASQUERADE

  • then enable ip routing on linux kernel

echo 1 > /proc/sys/net/ipv4/ip_forward

 

When you connect interface of the devices to the pnet9 network, which you enabled dhcp and give nat service over its router interace, you should be able to access outside with nat. Default dhcp enabled linux machines takes time to open, wait patiently!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.