How to Enable Internet for Guest Virtual Machine using Wi-Fi... Internet Connection. Table of Contents

[email protected]
How to Enable Internet for Guest Virtual Machine using Wi-Fi wireless
Internet Connection.
Table of Contents
1) Host, Guest and VBox version. ...................................................................................................................................................................... 2
2) Check your current Host and Guest Details ................................................................................................................................................... 3
3) Now let’s start to configure to enable Internet in Guest Solaris. .................................................................................................................. 6
(a)
Add 2nd Host Only Network at VBox Manager Level .................................................................................................................... 6
(b)
Modify the added 2nd adapter’s IP to (192.168.0.102) to be with range of Wi-Fi (192.168.0.101). ............................................. 6
(c)
Add 2nd Network adapter to Guest Solaris VM and Bridge the network with Wi-Fi. .................................................................... 7
4) Configure New IP (192.168.0.103) for Guest Solaris for newly added network adapter (e1000g1) ................................................... 8
(a)
Create a file for new interface (e1000g1) as below, so that IP persist the reboot. .... 9
(b)
Add the new IP details to /etc/host and name as oranet or (any name)..................................... 9
(c)
Add the new net mask to /etc/netmasks file ................................................................................................ 10
(d)
Add the Wi-Fi router Default Gateway details to /etc/defaultrouter ....................................... 10
(e)
Add the Wi-Fi router Default Gateway details as nameserver to /etc/resolv.conf ........... 10
(f)
Add dns after “file” keyword to /etc/nsswitch.conf ............................................................................. 11
(g)
Shutdown the Guest VM Solaris and start again. ...................................................................................... 11
(h)
Test DNS using dig if website is responding with address.............................................................. 11
(i)
Now open the www.google.com sites from Browser. .................................................................................... 12
1|P age
[email protected]
1) Host, Guest and VBox version.
Host: Windows 7 – 32 Bit
Virtual Box: 4.2.18 r88780
Guest: Solaris 10
2|P age
[email protected]
2) Check your current Host and Guest Details
Check your Internet / Wi-Fi Wireless Network IP
==========================================
From File -> Preferences Menu, You can see the default Ethernet adapter Virtual Box Host-Only
Network in Virtual Box Manager as below which came as part of VBox installation.
3|P age
[email protected]
You can see the IP address 192.168.56.1 which is default from VBox installation on Windows 7.
Below DHCP Server details may not be required, you can disable, I kept as it is.
4|P age
[email protected]
Check the Guest Machine (Solaris) Network Adapter1 to be as below.
Connect to Guest VM machine (Solaris) and verify the details as below, Keep IP of Guest Solaris (192.168.56.2)
with same IP range of default Ethernet adapter Virtual Box Host-Only Network (192.168.56.1) netmask
255.255.255.0, so that putty can connect to Solaris with IP ( 192.168.56.2 ).
5|P age
[email protected]
3) Now let’s start to configure to enable Internet in Guest Solaris.
As I do not want to chance the existing network for Host and Guest. I followed below two steps.
(a) Add 2nd Host Only Network at VBox Manager Level
From File -> Preferences Menu, You can see the default Ethernet adapter Virtual Box HostOnly Network in Virtual Box Manager as below which came as part of VBox installation.
You see the 2nd Host Only Ethernet Adapter at VBox Manager Level
(b) Modify the added 2nd adapter’s IP to (192.168.0.102) to be with range of Wi-Fi
(192.168.0.101).
6|P age
[email protected]
(c) Add 2nd Network adapter to Guest Solaris VM and Bridge the network with Wi-Fi.
Click on your Solaris Guest VM machine then click on network as below
7|P age
[email protected]
Change the options as per highlighted/shown below.
Start the Guest VM Solaris and login with putty to check the added Network Adapter
4) Configure New IP (192.168.0.103) for Guest Solaris for newly added
network adapter (e1000g1)
# dladm show-link
e1000g0
type: non-vlan
e1000g1
type: non-vlan
8|P age
mtu: 1500
mtu: 1500
device: e1000g0
device: e1000g1
[email protected]
# dladm show-dev
e1000g0
link: up
e1000g1
link: unknown
ifconfig
ifconfig
ifconfig
ifconfig
speed: 1000
speed: 0
Mbps
Mbps
duplex: full
duplex: half
e1000g1 plumb up
e1000g1
e1000g1 192.168.0.103 netmask 255.255.255.0 broadcast + up
e1000g1
(a) Create a file for new interface (e1000g1) as below, so that IP persist the
reboot.
# ls -ltr /etc/hostname.*
-rw-r--r-1 root
root
38 Oct 12 20:26 /etc/hostname.e1000g0
# cat /etc/hostname.e1000g0
(This is existing interface file)
192.168.56.2
netmask 255.255.255.0
New
====
# vi /etc/hostname.e1000g1
192.168.0.103 netmask 255.255.255.0
# cat /etc/hostname.e1000g1
192.168.0.103 netmask 255.255.255.0
-------------------------------------------------------------------------(b) Add the new IP details to /etc/host and name as oranet or (any name)
# cat /etc/hosts
#
# Internet host table
#
::1
localhost
127.0.0.1
localhost
192.168.56.2 orasolaris1 loghost
192.168.0.103 oranet loghost
--------------------------------------------------------------------------
9|P age
[email protected]
(c) Add the new net mask to /etc/netmasks file
# vi /etc/netmasks
#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
#
#
network-number netmask
#
# The term network-number refers to a number obtained from the Internet
Network
# Information Center.
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
#
128.32.0.0 255.255.255.0
#
192.168.56.0
255.255.255.0
192.168.0.0
255.255.255.0
-------------------------------------------------------------------------(d) Add the Wi-Fi router Default Gateway details to /etc/defaultrouter
Follow any one
===============
# vi /etc/defaultrouter
192.168.0.1
Default gateway mentioned above for the router
OR
# route -p add default 192.168.0.1
add net default: gateway 192.168.0.1
add persistent net default: gateway 192.168.0.1
# route -p show
persistent: route add default 192.168.0.1
-------------------------------------------------------------------------(e) Add the Wi-Fi router Default Gateway details as nameserver to
/etc/resolv.conf
vi /etc/resolv.conf
nameserver 192.168.0.1
# cat /etc/resolv.conf
nameserver 192.168.0.1
--------------------------------------------------------------------------
10 | P a g e
[email protected]
(f) Add dns after “file” keyword to /etc/nsswitch.conf
# cat /etc/nsswitch.conf|grep hosts:
# "hosts:" and "services:" in this file are used only if the
hosts:
files
# vi /etc/nsswitch.conf
….
hosts:
files dns
….
# cat /etc/nsswitch.conf|grep dns
hosts:
files dns
(g) Shutdown the Guest VM Solaris and start again.
# init 0
(h) Test DNS using dig if website is responding with address.
# ping www.google.com
www.google.com is alive
# dig www.google.com
; <<>> DiG 9.6.1-P3 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 255
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.google.com.
;; ANSWER SECTION:
www.google.com.
www.google.com.
www.google.com.
www.google.com.
www.google.com.
;;
;;
;;
;;
292
292
292
292
292
IN
IN
IN
IN
IN
Query time: 90 msec
SERVER: 192.168.0.1#53(192.168.0.1)
WHEN: Sun Oct 13 00:16:42 2013
MSG SIZE rcvd: 112
# nslookup www.google.com
Server:
192.168.0.1
Address:
192.168.0.1#53
Non-authoritative answer:
Name:
www.google.com
Address: 74.125.236.51
Name:
www.google.com
Address: 74.125.236.52
Name:
www.google.com
Address: 74.125.236.49
Name:
www.google.com
Address: 74.125.236.48
Name:
www.google.com
Address: 74.125.236.50
# ping www.yahoo.com
www.yahoo.com is alive
11 | P a g e
IN
A
A
A
A
A
A
74.125.236.49
74.125.236.48
74.125.236.50
74.125.236.51
74.125.236.52
[email protected]
# nslookup www.yahoo.com
Server:
192.168.0.1
Address:
192.168.0.1#53
Non-authoritative answer:
www.yahoo.com
canonical name = fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com canonical name = ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com canonical name = ds-sg-fp3-lfb.wg1.b.yahoo.com.
ds-sg-fp3-lfb.wg1.b.yahoo.com
canonical name = ds-sg-fp3.wg1.b.yahoo.com.
Name:
ds-sg-fp3.wg1.b.yahoo.com
Address: 106.10.139.246
# dig www.yahoo.com
; <<>> DiG 9.6.1-P3 <<>> www.yahoo.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 940
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.yahoo.com.
IN
;; ANSWER SECTION:
www.yahoo.com.
81
IN
fd-fp3.wg1.b.yahoo.com. 101
IN
ds-fp3.wg1.b.yahoo.com. 31
IN
ds-sg-fp3-lfb.wg1.b.yahoo.com. 101 IN
ds-sg-fp3.wg1.b.yahoo.com. 44
IN
;;
;;
;;
;;
A
CNAME
CNAME
CNAME
CNAME
A
fd-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com.
ds-sg-fp3-lfb.wg1.b.yahoo.com.
ds-sg-fp3.wg1.b.yahoo.com.
106.10.139.246
Query time: 89 msec
SERVER: 192.168.0.1#53(192.168.0.1)
WHEN: Sun Oct 13 00:19:42 2013
MSG SIZE rcvd: 147
(i) Now open the www.google.com sites from Browser.
12 | P a g e
[email protected]
REF
====
http://kenfallon.com/dns-working-but-not-resolving/
$ ping www.google.com
ping: unknown host www.google.com
The point here is that dig bypasses the host file and goes directly to the dns servers, while
ping will obey the Name Service Switch settings as defined in /etc/nsswitch.conf. The
solution is simply to edit the file and add the word dns to the line ipnodes: files
ipnodes: files dns
13 | P a g e
[email protected]
Just For info
==============
# route -p show
persistent: route add default 192.168.0.1
# route -p delete default 192.168.0.1
delete net default: gateway 192.168.0.1
delete persistent net default: gateway 192.168.0.1
#
# route -p show
No persistent routes are defined
#
14 | P a g e