Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
11-04-2016, 12:13 PM
|
#1
|
Member
Registered: Aug 2012
Posts: 789
Rep: 
|
Two IP address (static and dynamic) on same device
I have a Raspberry pi. It will operate a webserver to allow the user to configure it, and will have a static IP of 192.168.0.100 (or whatever).
After they configure it via the webserver, they will place it on their network, and it needs to use a dynamic IP provided by their DNS server.
Am I able to set up a Linux device so it has both a static and dynamic IP address?
|
|
|
11-04-2016, 12:40 PM
|
#2
|
Senior Member
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Rep: 
|
That would all depend on where in the network this device is connected. Is it connected directly to the providers network or is it sitting behind a router/switch that is connected to the providers network?
If it is connected directly to the providers network is the provider supplying more then one IP Address? If the provider is only allocating one IP then you cannot assign another on the same interface and have it work.
If connected to a device that can and does do NAT then you can configure more then one IP Address.
|
|
|
11-04-2016, 12:49 PM
|
#3
|
LQ Sage
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,675
Rep: 
|
Yes you can use alias, but two addresses cannot be on the same subnet.
|
|
|
11-04-2016, 05:55 PM
|
#4
|
Member
Registered: Aug 2012
Posts: 789
Original Poster
Rep: 
|
Thank you lazydog and Emerson.
|
|
|
11-04-2016, 06:12 PM
|
#5
|
Moderator
Registered: Aug 2002
Posts: 26,639
|
An IP alias can be on the same subnet.
One method would be to create a run-first service that sets an IP address as desired. Once its configured the run-first service is disabled. I assume the Pi is configured separately from the network. Depends on what OS/version you will use to configure the Pi but DHCP clients if they can not find a server will assign an AIPIA address i.e 169.254.x.x. If you assign a static AIPIA address to the Pi then a computer directly connected to the Pi should work without configuration.
Otherwise you need to manually configure the device connected to the Pi or know the network environment. How computer literate are they?
|
|
|
11-05-2016, 01:27 AM
|
#6
|
Senior Member
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Rep: 
|
Quote:
Originally Posted by Emerson
Yes you can use alias, but two addresses cannot be on the same subnet.
|
I'm curious as to why you say that?
|
|
|
11-05-2016, 08:58 AM
|
#7
|
LQ Sage
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,675
Rep: 
|
Well, I have tried it in past and I had some routing issues. I solved it by putting the alias on a different subnet. But then again, you may not need to route it at all if used only locally.
|
|
|
All times are GMT -5. The time now is 08:34 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|