Custom Search

Thursday, February 12, 2015

How to Setup Static IP Address VirtualBox Ubuntu VM

How to Setup Static IP Address VirtualBox Ubuntu VM

1)
Set Static IP Address

#sudo vim /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 10.0.2.15
netmask 255.255.255.0
gateway 10.0.2.2


auto eth1
iface eth1 inet static
address 192.168.56.102
netmask 255.255.255.0


2)
Set nameserver

#sudo vim /etc/resolv.conf
nameserver 8.8.8.8

3)
Reoot

#sudo reboot

4)
Check route

#route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.2.2        0.0.0.0         UG    100    0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1


5)
Try ping

#ping www.google.com



No comments:

Post a Comment