Unable to access the Internet while setting the static IP

Latest response

Hi Team,

I have assigned static IP in RHEL 7 after that i am unable to get the Internet access in server.

But If i assign to dhcp then able to access the internet. Please let us know how to get the Internet access even after setting to static IP in Server.

Responses

You could have missed setting a default gateway or DNS servers?

Hi Jamie Bainbridge ,

I have added the default Gateway entry as per based on my subnet IP.coming to DNS entry i don't have any DNS server this a test server but i can access if i set to dhcp IP. Please see the below network configuration details, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BOOTPROTO="static" DEVICE=ens33 ONBOOT=yes IPADDR=192.168.119.127 NETMASK=255.255.255.0 GATEWAY=192.168.119.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How do you access internet over there? Is this system configured to connect corporate or enterprise network then you may have to check for proxy settings? Otherwise, if this a simple home network where you connect to internet using internet service provider gateway then you may have to check if it is set properly?

What you could also do is that.... enable "dhcp" mode on your system... restart network service.. check what IP address gets assigned to your system.... and check out /etc/resolv.conf file as well.. also check out routing detaills... #ip route

Please provide more details of your setup so that community could help you..

Hi Sadashiva Murthy,

Please find the below some more details,

1.It's Simple home network i have flushed the firewall rules and disable the SELinux. 2.Network type is NAT. 3.Base Machine has Wi-Fi Access. 4.I don't have DNS configuration. If i configured to DHCP after network restart got the new IP then able to access the internet access in Virtual Machine.

Here i am looking for with Static IP how can to access the internet in my virtual network.

Hi Ibrahim,

In your case, one easy way to get both internet connection and static IP on the system is to assign one more IP address (need to add another network adapter) to the system. Later, set first interface to be on dhcp mode and second one on static mode. You could bind your hostname with static IP address set on secondary network interface, and this way you get to access internet, and you could ping your static IP from your host system. You would need to edit and set same range static IP address to your virtual network adapter so that it would allow communication from your base (host) to guest system. I tested this and works for me on my Latop which is running with Windows, and I've Virtual Box installed where there is guest VM with RHEL6.9 installed, eth0 is on NAT, eth1 is on Host-Only-Network with an IP address set for the gateway in same range for communication.

I hope this helps!

Thanks.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.