Help me! Why can't I access the internet on a static IP address?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I assume you are running version 6 and I confess to not having played with its default settings much. looks like it should be using 10.0.0.2.x/24
Is this a guest you installed your self?
I have seen other posts with a VB vm where it was using 192.168.x.x/24 and the NAT gateway was 192.168.x.2.
Since I am making some bad assumptions by reference to pinging router are you referring to the VB internal NAT gateway or the physical router on the LAN? Do you know the LAN network settings?
in that case you need to use an address between the lower and upper limits.
also gateway is probably the same as your dhcp server.
The thing is that I have a homework to do and one of the requirements is that the server has the ip address 192.168.101.1. Also, i thought that the gateway and DNS should have the ip address of the physical router of the LAN.
I assume you are running version 6 and I confess to not having played with its default settings much. looks like it should be using 10.0.0.2.x/24
Is this a guest you installed your self?
I have seen other posts with a VB vm where it was using 192.168.x.x/24 and the NAT gateway was 192.168.x.2.
Since I am making some bad assumptions by reference to pinging router are you referring to the VB internal NAT gateway or the physical router on the LAN? Do you know the LAN network settings?
I was referring to the gateway I set up in /etc/network/interfaces.
we still have no idea about your setup and configuration, therefore hard to way anything.
So you have a router, a dhcp server, a host, VMs, and who knows what. Need to know how are these devices connected to each other and to the internet, how are they configured and what do you want to achieve exactly (access internet from where?).
we still have no idea about your setup and configuration, therefore hard to way anything.
So you have a router, a dhcp server, a host, VMs, and who knows what. Need to know how are these devices connected to each other and to the internet, how are they configured and what do you want to achieve exactly (access internet from where?).
So, I have a physical router, a laptop that is connected to the router via Wi-Fi and on that laptop I have installed VirtualBox. Within VirtualBox, I have 2 VMs: one of them should act as a server and the other one should be the client. On the server VM I tried to set a static IP address. After I modified the /etc/network/interfaces and /etc/resolv.conf, I rebooted the VM and there was no internet connection. The only address I can ping is the address I chose for the ethernet interface (192.168.101.1).
/etc/network/interfaces:
auto enp0s3
iface enp0s3 inet static
address 192.168.101.1
netmask 255.255.255.0
network 192.168.101.0
broadcast 192.168.101.255
gateway 192.168.0.1 (this is the ip address of my physical router)
dns-nameservers 192.168.0.1 8.8.8.8 8.8.4.4
Ok so, I have a question. Does the gateway and DNS addresses have to be the same as my physical router's ip address?
no, you can install your DNS server (if you wish) anywhere you want, and also there are cases when the gateway is not the same as the router, but in small networks these IPs are usually the same.
Does the assignment or did the instructor explain how to configure the VB network? You posted your using NAT but the picture posted shows host only networking. Can post more of the details of your homework assignment? Does your server have two network adapters?
Host only network adapter does not allow traffic outside its internal network. In addition the client VM must be on the same host network as the server. If the client is still configured using DHCP then you need to change the host only DHCP server to match the static work address of your server.
FWIW: if your IP address needs to be fixed and have access external to the host you want your interface to be in BRIDGED mode rather than NAT mode. Network settings then will look much like those on the host, because it is actually bridged to that same network. DHCP address range of the DHCP server but on the same subnet.
Your understanding of the networking needs to be improved. Some reading might be required. This experiment should help with that.
I assume you are running version 6 and I confess to not having played with its default settings much. looks like it should be using 10.0.0.2.x/24
Is this a guest you installed your self?
I have seen other posts with a VB vm where it was using 192.168.x.x/24 and the NAT gateway was 192.168.x.2.
Since I am making some bad assumptions by reference to pinging router are you referring to the VB internal NAT gateway or the physical router on the LAN? Do you know the LAN network settings?
Quote:
Originally Posted by michaelk
Does the assignment or did the instructor explain how to configure the VB network? You posted your using NAT but the picture posted shows host only networking. Can post more of the details of your homework assignment? Does your server have two network adapters?
Host only network adapter does not allow traffic outside its internal network. In addition the client VM must be on the same host network as the server. If the client is still configured using DHCP then you need to change the host only DHCP server to match the static work address of your server.
I'll explain to you my assignment. I have to create 2 VMs. One should act as a server and the other one should act as a client. The server's IP address has to be 192.168.101.1/24. On the server VM I have to configure three services: dhcp, dns and ntp. The first thing I tried to do was to set the static ip address of the server. But after I tried this, I had no internet connection so I tried to find the solution on google, youtube, basically everywhere on the internet but I couldn't find any.
From the assignment I assume the server is acting like a gateway for the client if I understand correctly. That means the server needs two network adapters.
The WAN side should be configured as bridge mode, the other internal. The WAN adapter should be configured using DHCP which will provide the DNS and gateway to your LAN. The second adapter will be configured with a static IP address. No gateway or DNS needs to be configured. If the server is running a GUI you can configure a static IP address via the network manager applet.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.