Solved

static vs dynamic ip

Posted on 2004-09-27
27
409 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
  • 12
  • 9
  • 3
  • +2
27 Comments
 
LVL 2

Expert Comment

by:PowerToaster
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 10

Expert Comment

by:Luxana
Comment Utility
>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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
When it goes DHCP does it always get the same dynamic IP?
0
 
LVL 10

Expert Comment

by:Luxana
Comment Utility
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
Comment Utility
yes PowerToaster..... it does get same ip... :)


Cheers...
Pappu
0
 
LVL 2

Author Comment

by:vxlil
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 10

Expert Comment

by:Luxana
Comment Utility
you should at least know what time it always happening...

paste here
/etc/crontab
0
 
LVL 2

Author Comment

by:vxlil
Comment Utility
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
Comment Utility
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
Comment Utility
its happening every week....
regularly.....

pappu..
0
 
LVL 10

Expert Comment

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

Author Comment

by:vxlil
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed with points (125) refunded

DarthMod
Community Support Moderator
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now