Advertisement
shokti

centos 6.5 - dhcp and nat server

May 5th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. install dhcp server:
  2. yum install dhcp
  3.  
  4. select nic for the dhcp:
  5. nano /etc/sysconfig/dhcpd
  6. ----------------------------------------------------------------------
  7. DHCPDARGS=eth1
  8. ----------------------------------------------------------------------
  9.  
  10. copy sample config file:
  11. cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
  12.  
  13. configure dhcp scope:
  14. nano /etc/dhcp/dhcpd.conf
  15. ----------------------------------------------------------------------
  16. option domain-name “domain.local”;
  17. option domain-name-servers 8.8.8.8, 8.8.4.4;
  18.  
  19. default-lease-time 600;
  20. max-lease-time 7200;
  21.  
  22. log-facility local7;
  23.  
  24. subnet 192.168.0.0 netmask 255.255.255.0 {
  25. range 192.168.0.100 192.168.0.150;
  26. option domain-name-servers 8.8.8.8;
  27. option routers 192.168.0.1;
  28. }
  29. ----------------------------------------------------------------------
  30.  
  31. start dhcp:
  32. /etc/init.d/dhcpd start
  33.  
  34.  
  35. enable ip forwarding:
  36. echo 1 > /proc/sys/net/ipv4/ip_forward
  37.  
  38. nano /etc/sysctl.conf
  39. ---------------------------------------------
  40. net.ipv4.ip_forward = 1
  41. ---------------------------------------------
  42.  
  43. configure iptables:
  44. iptables -I FORWARD 1 -i eth1 -o eth0 -j ACCEPT
  45. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  46. service iptables save
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement