enable internet in virtual box solaris - · pdf filemicrosoft word - enable internet in...

14
[email protected] 1 | Page 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 2 nd Host Only Network at VBox Manager Level .................................................................................................................... 6 (b) Modify the added 2 nd adapter’s IP to (192.168.0.102) to be with range of Wi-Fi (192.168.0.101). ............................................. 6 (c) Add 2 nd 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

Upload: vucong

Post on 25-Mar-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

[email protected]

1 | P a g e

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 ora net 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 /et c/defaultrouter ....................................... 10

(e) Add the Wi-Fi router Default Gateway details as nam eserver 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 ad dress. ............................................................. 11

(i) Now open the www.google.com sites from Browser. .................................................................................... 12

[email protected]

2 | P a g e

1) Host, Guest and VBox version.

Host: Windows 7 – 32 Bit

Virtual Box: 4.2.18 r88780

Guest: Solaris 10

[email protected]

3 | P a g e

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.

[email protected]

4 | P a g e

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.

[email protected]

5 | P a g e

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 ).

[email protected]

6 | P a g e

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 Host-

Only 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).

[email protected]

7 | P a g e

(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

[email protected]

8 | P a g e

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 mtu: 1500 dev ice: e1000g0 e1000g1 type: non-vlan mtu: 1500 dev ice: e1000g1

[email protected]

9 | P a g e

# dladm show-dev e1000g0 link: up speed: 1000 Mbps duplex: full e1000g1 link: unknown speed: 0 Mbps duplex: half

ifconfig e1000g1 plumb up ifconfig e1000g1 ifconfig e1000g1 192.168.0.103 netmask 255.255.255.0 broadcast + up

ifconfig 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

--------------------------------------------------- -----------------------

[email protected]

10 | P a g e

(c) Add the new net mask to /etc/netmasks file

# vi /etc/netmasks

# # The netmasks file associates Internet Protocol (I P) address # masks with IP network numbers. # # network-number netmask # # The term network-number refers to a number obtain ed from the Internet Network # Information Center. # # Both the network-number and the netmasks are spec ified 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 /et c/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 nam eserver to

/etc/resolv.conf vi /etc/resolv.conf

nameserver 192.168.0.1

# cat /etc/resolv.conf nameserver 192.168.0.1 --------------------------------------------------- -----------------------

[email protected]

11 | P a g e

(f) Add dns after “file” keyword to /etc/nsswitch.conf

# cat /etc/nsswitch.conf|grep hosts: # "hosts:" and "services:" in this file are used on ly 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 ad dress.

# 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. IN A ;; ANSWER SECTION: www.google.com. 292 IN A 74. 125.236.49 www.google.com. 292 IN A 74. 125.236.48 www.google.com. 292 IN A 74. 125.236.50 www.google.com. 292 IN A 74. 125.236.51 www.google.com. 292 IN A 74. 125.236.52 ;; 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

[email protected]

12 | P a g e

# 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 A ;; ANSWER SECTION: www.yahoo.com. 81 IN CNAME fd- fp3.wg1.b.yahoo.com. fd-fp3.wg1.b.yahoo.com. 101 IN CNAME ds- fp3.wg1.b.yahoo.com. ds-fp3.wg1.b.yahoo.com. 31 IN CNAME ds- sg-fp3-lfb.wg1.b.yahoo.com. ds-sg-fp3-lfb.wg1.b.yahoo.com. 101 IN CNAME ds- sg-fp3.wg1.b.yahoo.com. ds-sg-fp3.wg1.b.yahoo.com. 44 IN A 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.

[email protected]

13 | P a g e

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

[email protected]

14 | P a g e

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 #