Static IP and DHCP at the same time?

This forum is for discussion about general software issues.

Static IP and DHCP at the same time?

Postby grayman4hire » Sun Aug 02, 2015 12:54 am

This is more of a general linux networking question...

On my Pogoplug E02/V4 running ALARM, is it possible to have both a static IP Address and receive a DHCP address from my router?

Basically, have a static IP Address of something like 192.168.0.2 but at the same time receive an IP Address from my router (192.168.1.x) on the same physical ethernet interface. I know it's trivial to setup multiple IP Addresses on the same physical interface, but wondering if it's possible with one IP being static and the other dynamic.

Any examples? Thank you in advance.
grayman4hire
 
Posts: 350
Joined: Sat Sep 29, 2012 12:03 am
Location: SF, CA

Re: Static IP and DHCP at the same time?

Postby opotonil » Tue Aug 04, 2015 9:46 am

I haven't tested, but if you are using systemd-networkd you can try:
$this->bbcode_second_pass_code('', '
...
[Network]
DHCP=yes
Address=192.168.0.2/24
...
')
opotonil
 
Posts: 44
Joined: Sat Feb 08, 2014 1:17 pm

Re: Static IP and DHCP at the same time?

Postby destroyedlolo » Tue Aug 04, 2015 10:40 am

I duno how you can configure it on Systemd based system, but you have to attach a secondary IP to your network interface.

For exemple :
$this->bbcode_second_pass_code('', 'ifconfig enp4s0:0 192.168.0.3')
destroyedlolo
 
Posts: 7
Joined: Sun Aug 02, 2015 6:12 pm

Re: Static IP and DHCP at the same time?

Postby WarheadsSE » Tue Aug 04, 2015 2:46 pm

or with more iproute2
$this->bbcode_second_pass_code('', 'ip addr add 192.168.0.2/24 dev enp2s0')

But there is likely a way in systemd-networkd 's .network files. I haven't read that tid bit or tried it myself yet.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests