?
Solved

static vs dynamic ip

Posted on 2004-09-27
27
Medium Priority
?
422 Views
Last Modified: 2013-12-16
Hi exps,
I have a redhat linux gateway which works as gateway,dns,dhcp and firewall for my lan.
It has two nic, one wiht outgoing static ip and one internal connected with static ip. since last few days, internal one goes on dynamic ip. this create problem, my destops stop connecting to internet. this is happening since last few weeks and with regular interwals of few days. To resolve this i have to assign internal nic with static same ip again and reastart netwerok service and named from /etc/init.d.
Pleaset help to resolve this issue.
Best Regards,
cheers
pappu
0
Comment
Question by:vxlil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 9
  • 3
  • +2
27 Comments
 
LVL 2

Expert Comment

by:PowerToaster
ID: 12162932
When you say it changes to DHCP, How are checking this? What version of Redhat? Does it get an IP when it is dhcp mode or does it default to an autoconfig?
0
 
LVL 6

Expert Comment

by:blkline
ID: 12182466
What is the contents of the following files:

/etc/sysconfig/network-scripts/ifcfg-eth0 & 

/etc/sysconfig/network-scripts/ifcfg-eth1
0
 
LVL 2

Author Comment

by:vxlil
ID: 12186981
Hi Blkline,
Please have look at the contents of

eth0 :

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.133.239
NETMASK=255.255.255.128
GATEWAY=192.168.133.239


eth1 :

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.49.74
NETMASK=255.255.255.252
GATEWAY=192.168.49.73


pappu


0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 10

Expert Comment

by:Luxana
ID: 12187077
>internal one goes on dynamic ip. this create problem, my destops stop connecting to internet

did you get dns setting on your desktop from your dhcp?

have a look to /etc/resolv.conf for nameserves and make sure that you are have thet address for name servaer and also if your setting for networkard have a proper gateway ip address
0
 
LVL 2

Author Comment

by:vxlil
ID: 12188569
Hi Luxana,
Yes all my desktop are getting all settings and ips and everything from dhcp.... including dns.

cheers..
pappu
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12188610
ok so I thing is time to give us more info..

why did you setup internal nic to dynamic IP? Or it happends by it self? And why the setting you show us is saying the both nic's are static? What is your desktop nic setting? how you are sharing internet? proxy? masqurade? :-)

0
 
LVL 2

Author Comment

by:vxlil
ID: 12188780
Hi Luxana,
Both nics of gateway are static.... all ip of desktop are dynamic from dhcp..... gateway is dhcp... and  dns..... but once in a week inter nic goes on to dynamic.... it simple... then i hve to bring it back to static once agin...

Cheers..
pappu
0
 
LVL 2

Expert Comment

by:PowerToaster
ID: 12188822
When it goes DHCP does it always get the same dynamic IP?
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12188968
you said that it is happenig regulary ! do you know the time? did you check logs such as /var/log/syslog or /var/log/messages and compare it with time when it is happennig? Are you runnig some scripts using cron?
0
 
LVL 2

Author Comment

by:vxlil
ID: 12188980
yes PowerToaster..... it does get same ip... :)


Cheers...
Pappu
0
 
LVL 2

Author Comment

by:vxlil
ID: 12198515
Hi guys,
I am not able to find the /var/log/syslog... but could /var/log/messages.... which is also useles....
waiting for your guideance buddies...

cheers...

pappu...
0
 
LVL 2

Expert Comment

by:PowerToaster
ID: 12202696
try this command.

cat /var/log/messages | grep xxx.xxx.xx.xx

replace the xx's with the ip address your machine gets, depending on how often your logrotater changes the logs you might also need to check messages.1 or .2.

If you find something that matches it will probably be the aquisition of the DHCP address and knowing what is happening at about the same time as the change would be helpful.
0
 
LVL 2

Author Comment

by:vxlil
ID: 12206007
Internal NIC :

ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0B:CD:F2:06:FD
          inet addr:192.168.133.239  Bcast:192.168.133.255  Mask:255.255.255.128
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:412326787 errors:0 dropped:0 overruns:0 frame:0
          TX packets:403018284 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:199892366 (190.6 Mb)  TX bytes:236592592 (225.6 Mb)
          Interrupt:29


Many Many entries in /var/log/message.2 :

Sep 15 04:00:36 gateway dhcpd: DHCPREQUEST for 192.168.133.162 from 00:0b:cd:f2:06:fd via eth0
Sep 15 04:00:36 gateway dhcpd: DHCPACK on 192.168.133.162 to 00:0b:cd:f2:06:fd via eth0


Sep 15 16:18:50 gateway dhcpd: DHCPREQUEST for 192.168.133.162 (192.168.133.239) from 00:0b:cd:f2:06:fd via eth0
Sep 15 16:18:50 gateway dhcpd: DHCPACK on 192.168.133.162 to 00:0b:cd:f2:06:fd via eth0
Sep 15 16:18:50 gateway dhclient: bound to 192.168.133.162 -- renewal in 217146 seconds.
Sep 15 16:34:02 gateway named[24184]: listening on IPv4 interface eth0, 192.168.133.162#53


Sep 18 19:10:34 gateway kernel: IN=eth1 OUT=eth0 SRC=192.168.122.250 DST=192.168.133.162 LEN=44 TOS=0x00 PREC=0x00 TTL=120 ID=31067 DF PROTO=TCP SPT=2506 DPT=139 WINDOW=8192 RES=0x00 SYN URGP=0
Sep 18 19:10:48 gateway kernel: IN=eth1 OUT=eth0 SRC=192.168.122.250 DST=192.168.133.162 LEN=44 TOS=0x00 PREC=0x00 TTL=120 ID=7262 DF PROTO=TCP SPT=2506 DPT=139 WINDOW=8192 RES=0x00 SYN URGP=0

Many Many entries in /var/log/message:

Oct  1 18:57:37 gateway kernel: IN=eth1 OUT=eth0 SRC=192.168.51.125 DST=192.168.133.162 LEN=44 TOS=0x00 PREC=0x00 TTL=114 ID=27076 DF PROTO=TCP SPT=1222 DPT=139 WINDOW=8192 RES=0x00 SYN URGP=0


N.B. Services viz., DNS and DHCP is also running on this machine.


cheers...
pappu
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12206443
you should at least know what time it always happening...

paste here
/etc/crontab
0
 
LVL 2

Author Comment

by:vxlil
ID: 12206629
Hi Luxana,
this is here....

-----------------------------------
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
~
------------------------


cheers..
pappu
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12206676
vxlil,

so what about the time ? You seaid that it is happening regulary, what time and when? also you did not answer my questions above if you are runinig some scrips wiith user cron?

This seems to me like you are palying some game. Answer questoin and use common sense to figeret out what can reguraly change your IP's..
0
 
LVL 2

Author Comment

by:vxlil
ID: 12206747
its happening every week....
regularly.....

pappu..
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12206848
what time ?...which day...? why you are not asnwering questions? is this a game?
0
 
LVL 2

Author Comment

by:vxlil
ID: 12207138
I applogize Luxana, i do  not remember the exact time... let me see time.. it was on 15 sept'04 around 5 PM.. then it again happnd two more time... but i don't have any recorded timings...

pappu
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12209547
everything is recorded in /var/log
time is important when it happen again check time save your current logs go through them ad look for something supicious with looking for time when it happened.
0
 
LVL 2

Author Comment

by:vxlil
ID: 12214653
Hi Luxana,
let me tell you this started... once I was just going through the dhcp configuration file...
I did executed one script... I do not remember the exact name of that script file... suddenly my internal NIC got the ip from dhcp. Since that time I am facing this issue.
What I feel, this is the same file.. which decides the lease time for desktops... but i don't know how to stop this happning.. and i would like to keep my internal NIC on static ip only...

N.B.:max-lease-time 604800

BR,
pappu
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12215174
we need to know more about that script ...what was the reason you run it ? paste here configureations files for your network card and also /etc/dhcpd.conf

when you run

# crontab -e
are there some entries? this command opens you root cron file.
0
 
LVL 2

Author Comment

by:vxlil
ID: 12215674
Hi Lunxana,
/etc/dhcpd.conf


-----------------------------------------------------------------------
default-lease-time 518400;
max-lease-time 604800;
ddns-update-style none;
option subnet-mask 255.255.255.128;
option broadcast-address 192.168.133.255;
option domain-name "etech";
option domain-name-servers 192.168.133.239;
#option domain-name-servers 192.168.135.249;
#option domain-name-servers 192.168.135.254;
option routers 192.168.133.239;
option netbios-name-servers 192.168.51.250;

subnet 192.168.133.0 netmask 255.255.255.0 {
#        authoritative;
        range 192.168.133.129 192.168.133.199;
}

----------------------------------------------------------------------------------

crontab -e is showing blank file....

pappu
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12215729
only you have root password and priviligies?

15 sept'04 was wednesday.. when it will happend again remeber exact time day and make backup of your /var/log/

we need to know more about that script ...what was the reason you run it ? paste here configureations files for your network card
0
 
LVL 2

Author Comment

by:vxlil
ID: 15264376
Hae Luxana,
Issues very stupid, my server was running dhcp client, it was taking ip from the dhcp server.

issue resolved...

cheers!

-vx
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 15795000
PAQed with points (125) refunded

DarthMod
Community Support Moderator
0

Featured Post

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question