LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How does one use DHCP to get the same IP address assigned every time on openSUSE (https://www.linuxquestions.org/questions/linux-newbie-8/how-does-one-use-dhcp-to-get-the-same-ip-address-assigned-every-time-on-opensuse-724493/)

rai6996 05-07-2009 04:39 PM

How does one use DHCP to get the same IP address assigned every time on openSUSE
 
I have a cable-modem / router that allows me to reserve an IP address for a particular MAC address - I have used this method to assign a "static-like" IP address to all my webCAMS, Windows boxes etc even though these devices themselves use DHCP to get IP addresses assigned from the router. I can'r seem to be able to do this with my openSUSE linux box. If I use Yast and configure my system for Static IP the router doesn't even know the machine exists. If I reserve an IP address (192.168.0.203) based on the MAC address of the Linux box and use DHCP, the router thinks it has assigned the correct IP address (192.168.0.203) to the Linux box but when I run ifconfig on the linux box it shows a completely different IP address (192.168.0.177)! I need my Linux Box to get the same IP address assigned so that I can use SAMBA, VNC Viewer etc from my windows machine - How can I achieve this ?

thanks much.

clvic 05-08-2009 01:35 PM

I'm not sure I understood.
I think you should do like this: you should instruct your router to always send answers to dhcp, and to send the same IP address for MAC addresses of your choice. Then, you should leave DHCP on all machines connected to the router. They will get the IP address automatically from the router

jkzfixme 05-08-2009 03:35 PM

dhcp by definition is dynamic. use static, you dont need to change the setting on your router and the ip will always be the same this will work on all routers.

go to yast - network devices - network cards. click on your card,then click on edit & fill in the details

Quote:

IPADDR='192.168.0.203'
BROADCAST='192.168.0.255'
NETMASK='255.255.255.0'
NETWORK='192.168.0.0'
GATEWAY='192.168.0.1'
the only thing you might need to change is the ip you want and the gateway whereas the gateway is the address you would type in to access your routers setup page

Regards
JKZfixme

jkzfixme 05-08-2009 03:38 PM

oh also if your looking to access stuff ie the vnc from outside your network make sure to setup port forwarding , one more reason to have a static IP so you dont end up changing it every time you dhcp lease is up

Regards,
JKZfixme

rai6996 05-09-2009 01:49 PM

Thanks all who attempted to answer my convoluted question - I did fix the problem - It was pretty simple after digging around a bit :

I edited the /etc/dhclient.conf file to include the following:

interface "eth0" {
send host-name "lin64quad";
send dhcp-requested-address 192.168.0.177;
}

Now I get my desired IP address of 192.168.0.177 assigned to me from the router all the time. And, since I've done all the proper Port Forwarding and firewall configuration on my router I can ftp or ssh OR VNC into my linux box from just about anywhere - Very happy :)


All times are GMT -5. The time now is 01:36 PM.