Ubuntu: Modifying /etc/network/interfaces



Question:

I'm actually in a cafe (similar to Starbuck, Tim Horton, Second Cup) where the router is likely protected. My ip address is currently 10.0.x.x, but I'd like to get a static network (with an ip address similar to 192.168.x.x) in modifying /etc/network/interfaces.

enter image description here

enter image description here

If I want to get inet 192.168.120.1, how could I modify this file such as it works?

auto lo             #automatically activates lo  iface lo inet loopback      #lo with 127.0.0.1 address   auto eth0           #automatically activates eth0  iface eth0 inet static      #eth0 with static config.    address 192.168.120.1     #sets IP address    netmask                   #sets subnet mask    broadcast                 #sets broadcast address    network                   #sets network address    gateway                   #sets default router  

Thanks for your help!


I wanted "to SSH" a virtual machine, but I think I need a network ID starting with 192.168.x.x instead of 10.0.x.x.


Solution:1

Instead of manipulating your routing table, you could create a virtual host-only network for your virtual machine (or machines). (I use VirtualBox; I'm not sure if the same feature exists in other virtualization software, but I'd be surprised if it didn't.) A host-only network is a private virtual network that connects the host to the virtual machines on the network. When a virtual machine that uses a host-only network is fired up, a network interface is fired up for the host system. It's similar to a loopback interface, because it's created in software and there is no hardware, but instead of merely looping back packets, it connects to all the virtual machines on the host-only network.

If the virtual machine needs access to the internet then it usually has two network interfaces, one for NAT and one for the host-only network. The advantage of a host-only network over a bridged network is that you can configure the IP addresses of virtual machines on the host-only network however you like, so a static network with 192.168.x.x addresses would be fine. I use a host-only network so that I can share files between the host and my virtual machines using Samba, and one would let you connect to your virtual machine using ssh.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »