How to set static IPV4 in linux
Using Virtual Box
nano /etc/network/interfaces auto eth0 inet static 192.168.1.39 netmask 255.255.255.0 gateway 192.168.1.1 "Cntrl-X" and "y" and "return" then reboot in several modes, bridged, Internal network, and NAT also have tried 10.1.2.39 in bridged mode (seems like NAT likes the 10.1 address space - not sure why yet) the the IPV4 is not changing so far. Looking for some insight from a more experienced user, Thank you. Brad |
I have a few thoughts off the top of my head:
If you are using "bridged mode" on a network in the 192.168.x.x range, you will not be able to set a static ip address in the range of 10.x.x.x and have it work. If you select "host only" networking, the VM cannot connect to the big wide world. It can connect only to other VMs configured for "host only" on the same host. There are some variations among distros regarding how to set a static ip. What distro are you trying to set a static ip address for? Have you checked the VirtualBox documentation on networking? |
Thanks, btw - I hit resolved my mistake.
I have checked the Virtual Box Doc's. Host only is fine. I am setting up a lab with Kali and Metasploitable-2. Additional inputs appreciated. Thanks. |
I can't see a clear explanation of what the issue is?
What I think you are saying the issue is, is that the VM is still getting dynamic IPs after setting up a static IP? If that is the case then I suspect the culprit maybe dhclient, it will be some form of DHCP anyway. What would also help is some output to show what you are seeing, what does the output of "ip addr" appear like? |
2: eth0: <BROADCAST ,MULTICAST , UP ,LOWER_UP> 1500 disc pfifo_fast state up group default qlen 1000
link/ether 08:00:27:f3:5a:23 brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0 valid_lft 86357sec preferred_lft 86357 sec inet6 fe80::b891:90b7:5e9d:35c9/64 scope link valid_lft forever preferred_lft forever (Kali) 2: eth0: <BROADCAST ,MULTICAST , UP ,LOWER_UP> 1500 disc pfifo_fast state up group default qlen 1000 link/ether 08:00:27:92:92:ee brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0 valid_lft 86357sec preferred_lft 86357 sec inet6 fe80::a00:27ff:fe92:92ee/64 scope link valid_lft forever preferred_lft forever (Metasploitable) NAT is the only network setting that displays IPV4. The addresses I assigned in aut0 /etc.. were 10.0.2.39 and 10.0.2.68. The addresses I am trying to assign are 192.168.1.38 and 192.168.1.68, respectively. Appreciate your help in getting this issue solved. |
mmm missed marking solved was a mistake...
Anyways. can you confirm which distro you are using, I've been assuming it is either Debian or Ubuntu but I can't see that you have said. |
The first load (Kali) is Debian
The second load (Metaspoitable) is Ubuntu thanks for engaging on this. |
So I am thinking dhclient or network-manager is the likely root of your problems, network-manager runs as a service.
For dhclient you can do "ps aux | grep dhclient" to see if it is running, just remember that this will also return the grep itself. you can then kill the dhclient process in anyway. If it is network manager then "sudo stop network-manager" will stop it. if it isn't either of these two then I am not certain what maybe causing the issue. |
dhclient or network-manager may have been at the root of the problem. I did however switch from Virtual Box to Vm ware and was able to set the static IP for the Debian (Kali), but not the Ubuntu. I receive a permission denied error when I go change the IP. I am apparently logged in as root user. At this point open too most suggestions.
|
Quote:
|
nano /etc/network/interfaces
auto eth0 inet static 192.168.1.68 netmask 255.255.255.0 gateway 192.168.1.1 "Cntrl-X"; "y" and then "return" yields Permission denied. thank you |
try "sudo nano /etc/network/interfaces"
you need root/superuser privs to edit /etc/network/interfaces |
perfect - thank you
|
All times are GMT -5. The time now is 02:56 PM. |