LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-04-2016, 12:13 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Rep: Reputation: Disabled
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?
 
Old 11-04-2016, 12:40 PM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
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.
 
Old 11-04-2016, 12:49 PM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,675

Rep: Reputation: Disabled
Yes you can use alias, but two addresses cannot be on the same subnet.
 
Old 11-04-2016, 05:55 PM   #4
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Thank you lazydog and Emerson.
 
Old 11-04-2016, 06:12 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,639

Rep: Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279Reputation: 6279
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?
 
Old 11-05-2016, 01:27 AM   #6
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by Emerson View Post
Yes you can use alias, but two addresses cannot be on the same subnet.
I'm curious as to why you say that?
 
Old 11-05-2016, 08:58 AM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,675

Rep: Reputation: Disabled
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.
 
  


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
dhclient returns dynamic IP address when configured to be static - but only on reboot Wocky Linux - Networking 3 04-16-2013 09:05 AM
How can I tell if my Linux server has a static or dynamic IP address assigned to it? RBMike Linux - Newbie 11 12-15-2009 05:05 PM
Getting wireless device dynamic ip address yawe_frek Linux - Wireless Networking 1 08-11-2008 08:58 AM
Static vs Dynamic IP Address Question amcmahon Linux - Networking 3 06-14-2007 10:24 AM
[SOLVED] Converting static IP-address to dynamic IP-address Blue_Ice Linux - Networking 3 07-20-2006 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:34 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
Open Source Consulting | Domain Registration