Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to assign a Dynamic IP from ISP? 1

Status
Not open for further replies.

taneujin

MIS
Aug 14, 2001
61
SG
Hi, I have a Linux server with 2 network cards. One to the internet and the other to the internal address. I used to have a fixed IP from my provider and thus I just used ifconfig to set the IP address of the NIC. I will be changing to another ISP but this time, I will be assigned an IP that will be rotated every few hours or so.

1)How do I configure the NIC to get the rotated IP addresses?

2)How do I make my internal NIC to recognise the new IP address that is assigned to the internet NIC?

3)Do I keep ip_forward on?

4)Do I need to modify my SQUID configurations?

Thanks for the help.
 
Sorry, more information about my situation

- using Mandrake
- provider is a broadband not dialup

Please help.
 
Hi,

As Mandrake is based on redhat they do it the same way. The config file is /etc/sysconfig/network-scripts/ifcfg-eth0 (or ifcfg-eth1 as appropriate) . You just need something in there like :

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

You'd also need the 'pump' rpm installed as thats the dhcp client software.

To test it out on the spot you need to do :

# /sbin/ifconfig eth0 down
# /sbin/ifconfig eth0 up

You'd leave IP forwarding on if you are doing masquerading or other routing. It should keep working as those rules are normally coded to masquerade out of an interface (e.g. eth1) rather than via an IP address.

On the squid - I don't see why that should need changing either unless you have got specific reference to the WAN IP address in the config for some reason.

Hope this helps
 
Thanks alot for your advice.
If you have an alternative way, please let me know as well as I am still learning Linux. Thanks!
 
I have done the steps as you have mentioned but it still does not work. Do I have to state somewhere the ip address of the dhcp server? Do I need to restart any services?
 
Hi,

No - you don't need the dhcp server IP address - that would imply an already working IP stack. However, the client requests (broadcasts) would need to reach the dhcp server and that could be a problem if broadcasts are not being forwarded somewhere between that box and the dhcp server at the other end.

You can always do a full network restart :

# /etc/rc.d/init.d/network restart

Also, look in the logs for DHCP messages - it should tell you if the server if request are being made and whether the server is being contacted :

# tail /var/log/messages

(You should see DHCPDISCOVER, DHCPOFFER, etc., messages - do after network restart)

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top