1

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?

2

3 Answers 3

1

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.

1

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.

0

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
1
  • 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, 2010 at 4:07

You must log in to answer this question.

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