CentOS - Network GateWay Server - part1
Nối tiếp part về Firewall, cá nhân mình nghĩ đã xài thì cần xài hẳn distro riêng, như vậy mới có tác dụng. Tuy nhiên cái gì cũng cần học, và thử. Mình làm tiếp loại tutorial này nối vào phần firewall với mục tiêu tự tay cấu hình 1 gateway server cho mạng, gồm dhcp - squid - iptables
Network Gateway Server
##################Install OS
a. CentOS Base Install
b. Network config
#setup
2 card mạng, 1 ra net, set default gateway, 1 làm mạng internal
eth0: 192.168.232.100/24 - DNS 192.168.232.2 Gateway: 192.168.232.2 ( VMware VM8)
eth1: 10.0.0.1/16
Trường hợp add new interface: setup/ network config / add device
#vim /etc/hosts
#vim /etc/resolv.conf
c. Soft Install
#yum install -y gcc-c++
#yum install -y bind-chroot nếu muốn triển khai DNS Server
###################DHCP
a. Install
#yum install -y dhcp*
b. Config
#vim /etc/dhcpd.conf
DHCP Server Configuration file.
see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
#cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
#vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;subnet 10.0.0.0 netmask 255.255.0.0 {
--- default gateway
option routers 10.0.0.1;
option subnet-mask 255.255.0.0;
ddns-update-style interim;
ignore client-updates;subnet 10.0.0.0 netmask 255.255.0.0 {
--- default gateway
option routers 10.0.0.1;
option subnet-mask 255.255.0.0;option nis-domain "hbn.local";
option domain-name "hbn.local";
option domain-name-servers 10.0.0.1;option time-offset -18000; # Eastern Standard Time
option ntp-servers 192.168.1.1;
option netbios-name-servers 192.168.1.1;
--- Selects point-to-point node (default is hybrid). Don't change this unless
-- you understand Netbios very well
option netbios-node-type 2;
range dynamic-bootp 10.0.0.100 10.0.0.254;
default-lease-time 21600;
max-lease-time 43200;we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
#chkconfig dhcpd --level 35 on
#service dhcpd on
Thêm cái này để mấy e client còn ra net đc
#vim /etc/sysctl.conf
net.ipv4.ip_forward =0 và net.ipv4.conf.default.accept_source_route = 0
Đổi sang 1
#service network restart
#setup
setup/firewall config/enable firewall + disable se-linux
#vim /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_netbios_ns iptable_nat"
#echo "" /etc/sysconfig/iptables
#iptables -t nat -A POSTROUTING -s 10.0.0.0/16 -d 0/0 -j MASQUERADE
#iptables-save gateway.txt
If reboot: iptables-restore gateway.txt or write shell to load it on bootup, but i think it is not necessary to do it because my server run 24/24
Tạm xong phần DHCP server. H test xem client đã nhận + ra net ổn chưa.
Xem các máy đã nhận IP:
#vim /var/lib/dhcpd/dhcpd.leases
Thanks for reading
--------------------------------------------------------------------------
All my Lab:
Linux Lab -- window and Cisco Lab
to be continued - I will update more.
Nam Habach