Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two network adapters on Virtual Box for Ubuntu Server.

  • Adapter 1: internal network called intent
  • Adapter 2: NAT

I want to configure them as follows:

  • Static IP 192.168.10.101 for the internal network adapter, netmask 255.255.255.0
  • DHCP IP for the NAT adapter

How can I do this?

share|improve this question

2 Answers 2

Log in to the virtual box with your normal account and use su to get an admin account.

Then open /etc/network/interfaces in an editor.

To set up a static IP use

iface eth0 inet static
address 192.168.10.101
netmask 255.255.255.0
gateway 192.168.1.1 

Sadly I am not sure what you mean with DHCP IP for the NAT adapter

To setting up a simply DHCP IP for eth1 use add

auto eth1
iface eth1 inet dhcp

to the file you just edited.

If you want this line to connect to the outside world with and actually do NATting then you will need to enable IP forwarding, load the MASQ module and set up some routing. If that is you goal then please clarify your post.

share|improve this answer

To do so you will need to enter the following code and create a password (you will be prompted to enter it twice):

sudo passwd root

This will allow you to become the root user. Then enter:

su

Then use the vi editor with the following:

vi /etc/network/interfaces

This will let you change the desired settings, just hit i to edit. When finished, hit Esc, then type :x to save the changes.

share|improve this answer

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.