0

i have server which two int. and static ip. And i need one work in local network and another work to internet. How configure interfaces ?

1

1 Answer 1

0

If you want to configure Static IP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card

sudo nano /etc/network/interfaces

Set the primary network interface - to internet

auto eth0
iface eth0 inet static
address 192.168.xxx.xxx
gateway 192.168.xxx.xxx
netmask 255.255.255.0

then configure second interface - to lan

auto eth1
iface eth1 inet static
address 192.168.yyy.yyy
gateway 192.168.yyy.yyy
netmask 255.255.255.0

You need to enter all the details like address,netmask and gateways values after entering all the values save this file and you need to restart networking services in debian using the following command to take effect of our new ipaddress.

After entering all the details you need to restart networking services using the following command

sudo /etc/init.d/networking restart

Setting up your hostname upon a ubuntu installation is very straightforward. You can directly query, or set, the hostname with the hostname command.

As an user you can see your current hostname with

sudo /bin/hostname

Example

To set the hostname directly you can become root and run

sudo /bin/hostname newname

When your system boots it will automatically read the hostname from the file /etc/hostname

When it comes to DNS setup Ubuntu doesn't differ from other distributions. You can add hostname and IP addresses to the file /etc/hosts for static lookups.

To cause your machine to consult with a particular server for name lookups you simply add their addresses to /etc/resolv.conf.

For example a machine which should perform lookups from the DNS server at IP address 8.8.8.8 would have a resolv.conf file looking like this

sudo nano /etc/resolv.conf

enter the following details

nameserver 8.8.8.8

Now to setup traffic from internet to lan and from lan to internet

The first thing to do is do enable IP forwarding. This is done either by using

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

Then, we will add a rule telling to forward the traffic

sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .