Skip to content

Instantly share code, notes, and snippets.

@sidsamant
Last active May 5, 2018 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidsamant/9a098fd3d8fbb7bf40ed349e0efb95dd to your computer and use it in GitHub Desktop.
Save sidsamant/9a098fd3d8fbb7bf40ed349e0efb95dd to your computer and use it in GitHub Desktop.
VM VirtualBox Host-Only Adapter, Static IP, Internet Access, Windows 10 Host, Fedora 26 Guest
Steps I followed to have my windows 10 host connect to Fedora 26 guest with static IP though host-only adapter and also allow the VM to connect to Internet through the host.
In VM VirtualBox,
1. File -> Preferences -> Network
NAT Networks tab
------------------
a. Hit the icon for 'Adds new NAT network'.
b. Wait till a new NAT Network adapter is created and added to the list. For me, it was named as 'NatNetwork'.
c. Double click the adapter to edit its details.
d. In the NAT Network Details window, set the following :
> Check Enable Network
> Network CIDR : 10.0.2.0/24
> Network Options :
Check 'Supports DHCP'
Uncheck 'Supports IPv6'
> Hit OK.
Host-only Networks tab
------------------
a. Hit the icon for 'Adds new host-only network'.
b. Wait till a new Host-only adapter is created and added to the list. For me it was named as 'VirtualBox Host-Only Ethernet Adapter #3'.
c. Double click the adapter to edit its details.
d. In the Host-only Network Details window, set the following :
i. Adapter tab
IPv4 Address: 192.168.0.1 <This is the gateway for the local network for host and the VM>
IPv4 Network Mask: 255.255.255.0
ii. DHCP Server
Keep it disabled.
ii. Hit OK.
Hit OK.
2. Right Click + Settings on the target VM from the list.
a. Hit 'Network'.
i. Adapter 1 tab, set the following:
> Enable Network Adapter
> Attached to : Host-only Adapter
> Name : <Name of your new Host-only adapter created above>
> Enable Cable Connected
> The rest keep at default values.
ii. Adapter 2 tab, set the following:
> Enable Network Adapter
> Attached to : NAT Network
> Name : <Name of your new NAT network adapter created above>
> Enable Cable Connected
> The rest keep at default values.
> Hit OK.
3. Start the VM.
4. When Fedora loads up, start a terminal and run the following commands.
a. ip add
- should show 3 interfaces (For me, they were lo, enp0s3, enp0s8)
b. vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
- edit the config file for the interface.
- setup the config for a static IP.
- save the file
c. systemctl restart network
- restart the network with new config file
That did it for me! Let me know if I need to elaborate any part.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment