Monday, February 21, 2011

ubuntu-dhcp-and-two-interface-config

sudo apt-get update......

1.IP address configuration......
vi /etc/network/interface

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
auto eth1
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

iface eth1 inet static
address 10.10.10.1
netmask 255.255.255.0
~


2.DNS to assign a dns to the computer
vi /etc resolv.conf

nameserver 192.168.111.50
nameserver 8.8.8.8


3. how to make NAT
vi /etc rc.local

# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # write this script to run NAT while boot

exit 0
~
4.IP Forward
sudo sysctl -w net.ipv4.ip_forward=1



5.DHCP config
vi /etc/dhcp3/dhcpd.conf

# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
option domain-name-servers 8.8.8.8;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.10 10.10.10.30;
option subnet-mask 255.255.255.0;
option routers 10.10.10.1;
}

No comments:

Post a Comment