LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-23-2018, 11:14 AM   #1
satyammehrotra
LQ Newbie
 
Registered: Jun 2018
Posts: 7

Rep: Reputation: Disabled
cant get static ip


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?
 
Old 06-23-2018, 02:41 PM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,642

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080
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.
 
Old 06-23-2018, 02:55 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,220

Rep: Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216
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.
 
Old 06-23-2018, 03:00 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 20,269

Rep: Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902
Quote:
Originally Posted by satyammehrotra View Post
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?
As in your other thread: https://www.linuxquestions.org/quest...lp-4175632473/

...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.
 
Old 06-23-2018, 08:36 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 13,689
Blog Entries: 22

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 06-24-2018, 06:43 AM   #6
satyammehrotra
LQ Newbie
 
Registered: Jun 2018
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
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.
 
Old 06-24-2018, 09:12 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 20,269

Rep: Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902
Quote:
Originally Posted by satyammehrotra View Post
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?
 
Old 06-24-2018, 09:44 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,220

Rep: Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216Reputation: 2216
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.
 
Old 06-24-2018, 09:54 AM   #9
satyammehrotra
LQ Newbie
 
Registered: Jun 2018
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
...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.
 
Old 06-24-2018, 10:36 AM   #10
Honest Abe
Member
 
Registered: May 2018
Distribution: CentOS 7, OpenSUSE 15
Posts: 119
Blog Entries: 1

Rep: Reputation: 53
Quote:
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.
 
Old 06-24-2018, 11:46 AM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 20,269

Rep: Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902Reputation: 4902
Quote:
Originally Posted by satyammehrotra View Post
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'.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setting static IP on linux PCs with no static IP address from internet provider? solvetek Linux - Networking 1 10-22-2011 08:04 AM
Java non-static variable cannot be referenced from a static context issue rickrvo Programming 2 02-12-2010 03:26 PM
How to initialize a static array of a class in a static member function lali.p Programming 9 02-16-2008 09:27 AM
Howto Assign Multiple Static Public IP Addresses under SBC's PPPoE Static Ip system o trekgraham Linux - Networking 8 04-17-2007 10:51 AM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration