On Server
-----------------------
eth0 ---->Connected to internet
eth1 ---->Local Area Network (100.0.0.100)
Turn on ip forwarding in kernel
# vi /etc/sysctl.conf
...
net.ipv4.ip_forward = 1
...
#
Configure the network interfaces
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp
...
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
...
DEVICE=eth1
TYPE=Ethernet
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=static
IPADDR=100.0.0.100
PREFIX=24
#
# service network restart
Share internet connection(Work as a Router)
Setup IP forwarding and Masquerading (to act as router)
# service iptables stop
# iptables -t nat -A POSTROUTING --out-interface eth0 -j MASQUERADE
# iptables -A FORWARD --in-interface eth1 -j ACCEPT
# service iptables save
# service iptables restart
# chkconfig iptables on
On-Client Machine
=======================
Point all desktop client to eth1 IP address as Router/Gateway.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=100.0.0.101
PREFIX=24
...
#
# vi /etc/sysconfig/network
...
GATEWAY=100.0.0.100
#
# vi /etc/resolv.conf
nameserver 8.8.8.8
#
-----------------------
eth0 ---->Connected to internet
eth1 ---->Local Area Network (100.0.0.100)
Turn on ip forwarding in kernel
# vi /etc/sysctl.conf
...
net.ipv4.ip_forward = 1
...
#
Configure the network interfaces
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp
...
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
...
DEVICE=eth1
TYPE=Ethernet
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=static
IPADDR=100.0.0.100
PREFIX=24
#
# service network restart
Share internet connection(Work as a Router)
Setup IP forwarding and Masquerading (to act as router)
# service iptables stop
# iptables -t nat -A POSTROUTING --out-interface eth0 -j MASQUERADE
# iptables -A FORWARD --in-interface eth1 -j ACCEPT
# service iptables save
# service iptables restart
# chkconfig iptables on
On-Client Machine
=======================
Point all desktop client to eth1 IP address as Router/Gateway.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=100.0.0.101
PREFIX=24
...
#
# vi /etc/sysconfig/network
...
GATEWAY=100.0.0.100
#
# vi /etc/resolv.conf
nameserver 8.8.8.8
#