Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
guys I created a virtual box machine and I used NAT and INT as two network cards and I also enabled DHCP. but now I want a static ip for my machine since it changes every time I restart, so is there any way to get static ip?
Yes. I do not recall the term, but you can SHARE an interface (passthrough) and configure the guest networking as if it were a stand-alone machine. Look in the network interface settings in your VB definition for this guest.
It also helps to read the documentation, and use duckduckgo or google to seek out online documents related to VB networking. Last time I looked (2011) there was a TON of good documentation available, and there should be even more out there today.
I assume by INT the OP is referring to Internal networking mode. You have not posted enough information as to what you are trying to accomplish or which interface you are trying to configure. Static IPs are usually assigned by the operating system itself and without that information there isn't much help we can provide.
guys I created a virtual box machine and I used NAT and INT as two network cards and I also enabled DHCP. but now I want a static ip for my machine since it changes every time I restart, so is there any way to get static ip?
...you appear to have done no research. Because putting "how to set a static IP address in Linux" into Google pulls up a LOT. You say nothing about your distro, but this is VERY well documented for any flavor of Linux.
Set the VM to use a "bridged" adapter in the VirtualBox settings for that VM, so the VM will be within your LAN. Then research how to set a static IP for the distro you are using in the VM.
I assume by INT the OP is referring to Internal networking mode. You have not posted enough information as to what you are trying to accomplish or which interface you are trying to configure. Static IPs are usually assigned by the operating system itself and without that information there isn't much help we can provide.
Sorry for less information...I am using CentOS and I created 2 VM's. I used NAT for internet and INT network for VM's to connect with each other. but when I use putty to connect , the NAT adapter changes IP every time I restart , so is there any way to make it fix, I tried several methods from google , but as soon as I use them and change my settings of the NAT adapter my internet stops working.
Sorry for less information...I am using CentOS and I created 2 VM's. I used NAT for internet and INT network for VM's to connect with each other. but when I use putty to connect , the NAT adapter changes IP every time I restart , so is there any way to make it fix, I tried several methods from google , but as soon as I use them and change my settings of the NAT adapter my internet stops working.
...and you STILL don't tell us what 'several methods' you've tried, or what version of CentOS you're using. Again, there are a LOT of easily-found guides...why don't you tell us which one(s) you used and tried?
What you posted is still not very clear nor provides any details.
You can use the network manager applet to configure a static address if running a GUI. However it needs to match the VB configuration. Are you trying to communicate between host and guest or between guests?
There is NAT and NAT service. How are guests configured.? A NAT adapter does not allow communication between host and guest or between guests by default.
...and you STILL don't tell us what 'several methods' you've tried, or what version of CentOS you're using. Again, there are a LOT of easily-found guides...why don't you tell us which one(s) you used and tried?
I am using CentOS 7.4 minimal install(no GUI) and the method I saw in you tube told to vi the network adapter file and put a static IP there, but as soon as I do that my internet stops working. and I am just trying to set static IP for connecting it to Putty.
I am using CentOS and I created 2 VM's. I used NAT for internet and INT network for VM's to connect with each other. but when I use putty to connect , the NAT adapter changes IP every time I restart , so is there any way to make it fix, I tried several methods from google , but as soon as I use them and change my settings of the NAT adapter my internet stops working.
Is this your test lab ?
A simple workaround world be to add an extra NIC (or two) and set up static IP on the other NIC.
That way, anything you want to install/browse could be fetched from the internet, and you can have a static,private IP for your own access.
To give an example -
Code:
[root@examserver3 ~]# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
link/ether 52:54:00:d5:2b:09 brd ff:ff:ff:ff:ff:ff
3: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
link/ether 52:54:00:d5:2b:09 brd ff:ff:ff:ff:ff:ff
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:c2:24:67 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.184/24 brd 192.168.122.255 scope global dynamic eth0
valid_lft 3232sec preferred_lft 3232sec
inet6 fe80::5054:ff:fec2:2467/64 scope link
valid_lft forever preferred_lft forever
5: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 52:54:00:d5:2b:09 brd ff:ff:ff:ff:ff:ff
inet 172.16.3.25/24 brd 172.16.3.255 scope global team0
valid_lft forever preferred_lft forever
inet 10.10.100.155/24 brd 10.10.100.255 scope global team0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fed5:2b09/64 scope link
valid_lft forever preferred_lft forever
Guest's IP on eth0 is fed from the Host (also CentOS) via DHCP through the virbr0. Guest shares internet via this interface from the host machine. ens4 and ens5 are link aggregated to the team0 config and holds two static IPs for my practice.
If I set up a static IP on eth0, my internet stops working too.
Last edited by Honest Abe; 06-24-2018 at 10:40 AM.
I am using CentOS 7.4 minimal install(no GUI) and the method I saw in you tube told to vi the network adapter file and put a static IP there, but as soon as I do that my internet stops working. and I am just trying to set static IP for connecting it to Putty.
And this **STILL TELLS US NOTHING** does it? What 'method I saw in you tube'???? Which file? What did you put in? How???
AGAIN, if you tried looking this up using the search term you were ALREADY GIVEN, you would have found the solution. Adding "centos 7.4" to the end of the string you've been handed already, gives you lots. The FIRST TWO HITS have step-by-step instructions. Aside from typing that in for you, there's not a lot more to solving your 'problem'.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.