Different IP address for different accounts in same box

CptCharis

Well-Known Member
Joined
Feb 27, 2018
Messages
562
Reaction score
465
Credits
970
Hello everybody hope you are good.
I would like to ask you if there is a possibility a pc with two different account to use different IP address for each of this accounts.
Here is the idea: We have a laptop that we need to set up a static IP when we are in the house but when we are outside we want this laptop to use DHCP.
Thank you. Stay safe.
 


TechnoJunky

Well-Known Member
Joined
Dec 3, 2018
Messages
493
Reaction score
390
Credits
314
I don't know if anyone has a better solution, but what I've done is to hard code my IP into my router. You set your lease to never expire. Then your laptop connects via DHCP and gets the same address every time in the house and gets whatever when you travel.
 

TechnoJunky

Well-Known Member
Joined
Dec 3, 2018
Messages
493
Reaction score
390
Credits
314
It would depend on your router. My ISP is AT&T, they provide the router, which has DHCP on it. I log into the router and then go to the DHCP tab and modify there. Yours could be very different.
 
OP
CptCharis

CptCharis

Well-Known Member
Joined
Feb 27, 2018
Messages
562
Reaction score
465
Credits
970
It would depend on your router. My ISP is AT&T, they provide the router, which has DHCP on it. I log into the router and then go to the DHCP tab and modify there. Yours could be very different.

I know it's a little bit old post but I found a better way and I like to share.
nmcli command can add another connection with the same device and switch between then as you wish.
 

khedger

Active Member
Joined
Jun 7, 2019
Messages
152
Reaction score
85
Credits
1,294
Not a heavy network guy, but what you describe is exactly how my home network works. My wireless router is a DHCP server for my LAN and it acts as a DHCP client to my ISP when accessing the internet. So, you should be able to do the same thing with just your single client on your LAN. Of course, you could then add other clients to your LAN at will.

keith
 
Last edited:

khedger

Active Member
Joined
Jun 7, 2019
Messages
152
Reaction score
85
Credits
1,294
To be more complete, with the configuration I described above, you can have something like a network 192.168.1.(0-255) for your LAN, and all of your devices would be dynamically served an IP address somewhere in that range. The router would be issued a dynamic IP from your ISP on their network - for example 215.225.14.4. The 'world' would access your router by this IP address. Nobody on the WAN (Internet) would know about your LAN IP addresses on the 192.168.1 network.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top