LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   setting static IP on linux PCs with no static IP address from internet provider? (https://www.linuxquestions.org/questions/linux-networking-3/setting-static-ip-on-linux-pcs-with-no-static-ip-address-from-internet-provider-909513/)

solvetek 10-22-2011 07:14 AM

setting static IP on linux PCs with no static IP address from internet provider?
 
I am connected to the internet via cable modem. I have a 4 port router plugged into the cable modem. I have 2 linux PCs connected to the the router. They are networked together and both have internet access. I would like to set static IP addresses on both linux boxes so that I do not have to change /etc/hosts when DHCP changes their IP.

question
Is this possible set static IPs with the network I have? My cable modem is from Cablevision Optium online and does not have a static ip. Do I need a static IP address from the cable company to set static IPs on my linux boxes.

-------------------------
linux box 1
-------------------------
computer os: centos 5.7 64-bit
hostname: server.localdomain
current ip eth0: 192.168.1.6 -> This changes alot, I would like to convert to static
default gateway: 192.168.1.1

-------------------------
linux box 2
-------------------------
computer os: centos 5.7 64-bit
hostname: laptop.localdomain
current ip eth0: 192.168.1.4 -> This changes a lot , I would like to convert to static
default gateway: 192.168.1.1

macemoneta 10-22-2011 08:04 AM

What you need to do is to check the IP range for DHCP in your cable modem. For example, if it's set to 192.168.1.2 -> 192.168.1.50 pick a couple of addresses outside the range. For example, 192.168.1.51 and 192.168.1.52. Configure your two PCs to use those static addresses, with the same netmask (for example, 255.255.255.0) and gateway.


All times are GMT -5. The time now is 08:10 AM.