Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running Ubuntu Desktop and Ubuntu Server editions on two separate VMs.

For the desktop I have set network adapters:

  1. Adapter 1: internal network called intnet

  2. Adapter 2: NAT

Server adapters:

  1. Adapter 1: internal network called intnet

Now I'm suppose to set ip addresses which I'm pretty sure you do by editing the /etc/network/interfaces file but I'm new to this I don't really get it.

Ubuntu Desktop:

static IP 192.168.10.100 for the internal network adapter

netmask 255.255.255.0

dhcp IP for the NAT adapter

Ubuntu Server:

static IP 192.168.10.101

netmask 255.255.255.0

^ This is what I need to have set.. how do I do this? I've tried a few things and reset the network and it didn't work. Please can anyone help?

share|improve this question

migrated from stackoverflow.com Dec 10 '10 at 3:55

This question came from our site for professional and enthusiast programmers.

    
possible duplicate of Setting up IP addresses in Linux networking –  Mark Henderson Dec 10 '10 at 4:08
    
I've already merged the questions. –  splattne Dec 13 '10 at 8:51

3 Answers 3

You need something like this in /etc/network/interfaces

auto eth0
iface eth0 inet static
        address 192.168.100.100
        gateway 192.168.100.1
        netmask 255.255.255.0

Don't put the gateway line on the server with the Internet connection. Its 192.168.100 address should be the gateway address for the other hosts. See man interfaces for information on the interfaces file.

share|improve this answer

The NAT adapter could be either eth0 or eth1 depending on which one it is connected to. Run tail -f /var/log/messages and remove the cable for either network. Wait a few seconds and reconnect. You will get a log message about the connection going up identifying which interface is which. I try to have eth0 the network (NAT) connection.

I would suggest you install Shorewall and start with the two-interface configuration found in /usr/share/doc/shorewall/examples/two-interface.

Your network info for the NAT connection will likely be:

auto eth0
iface eth0 inet dhcp

If you have a static IP it should be the same as the other interface with the appropriate ip address and net mask. It should also be the only interface with a gateway line. See man interfaces for detail on the file.

share|improve this answer

Here is the configuration that I usually use for ubuntu servers (/etc/network/interfaces).

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
   address 192.168.10.100
   netmask 255.255.255.0
   gateway 192.168.10.254

For a DHCP-assigned interface, you can replace the line starting with iface with:

iface eth0 inet dhcp

Don't forget to set your IPs and gateway properly in the example shown above. Also you need to restart the networking service.

$ sudo /etc/init.d/networking restart
share|improve this answer
    
Thanks but what about the NAT adapter on the desktop? If I run ifconfig it says I have eth0 and eth1 which one would be my NAT adapter and how do I set that? Thanks for the help. –  Dan Dec 10 '10 at 4:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.