DHCPCD - re-allocate IP
Posted: 10 Jul 2012, 08:55
Recently transferred from SLAX environment to Porteus and struggling with something that used to work
- perhaps I was abusing the system and getting away with it before!
I want to be able to switch operation (live) from having an allocated DHCP address to setting my own ... then when required, swap back again
e.g.
Start with DHCP allocated IP and use on one network; then connect to alternative network & select IP of say 100.0.0.10; then connect back to original and re-enable DHCP again
Used to do this using commands ....
To disable DHCP and define my own IP
dhcpcd -k eth0
sleep 2
ifconfig eth0 up
ifconfig eth0 100.0.0.1
Then to re-enable DHCP:
ifconfig eth0 up
dhcpcd eth0
ifconfig eth0 up
Note: I had to include the 'up' commands to ensure the interface always came up correctly.
However, this does not work under Porteus. Although the manually set IP is allocated, it does not stick. It goes back to the automatically assigned IP again.
Any clues or suggestions please
Many Thanks
John
- perhaps I was abusing the system and getting away with it before!
I want to be able to switch operation (live) from having an allocated DHCP address to setting my own ... then when required, swap back again
e.g.
Start with DHCP allocated IP and use on one network; then connect to alternative network & select IP of say 100.0.0.10; then connect back to original and re-enable DHCP again
Used to do this using commands ....
To disable DHCP and define my own IP
dhcpcd -k eth0
sleep 2
ifconfig eth0 up
ifconfig eth0 100.0.0.1
Then to re-enable DHCP:
ifconfig eth0 up
dhcpcd eth0
ifconfig eth0 up
Note: I had to include the 'up' commands to ensure the interface always came up correctly.
However, this does not work under Porteus. Although the manually set IP is allocated, it does not stick. It goes back to the automatically assigned IP again.
Any clues or suggestions please
Many Thanks
John