Sponsored Content
Full Discussion: testing a dhcp connection
Top Forums Shell Programming and Scripting testing a dhcp connection Post 302331731 by chebarbudo on Tuesday 7th of July 2009 04:50:55 AM
Old 07-07-2009
testing a dhcp connection

Hi there,

I have a computers that has a fixed address :
Code:
terminal48:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 172.16.150.151
netmask 255.255.0.0
network 172.16.0.0
broadcast 172.16.255.255
gateway 172.16.100.3

I'd like to switch it to a dhcp address but before editing the file, I need to be sure it will be able to contact the dhcp server. Indeed, I can only remote control the computer (ssh) and have no physical access to it. If I edit the file, restart the networking and if the computer cannot get an dhcp ip address, I permanently loose control over it.

Is there a command that can test a dhcp connection without actually modifying the current parameters?

Thanks for your help

Santiago
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Testing ssh connection from KSH script

Hi. I have a kornshell script that runs on a daily basis as a cron job. Part of what the script does is copy the folder contents from another server to the current server (server where KSH script is running). I have a scp command, as follows: scp $REMOTE_HOST:$REMOTE_FILE_DIR/* $TMP_DIR ... (8 Replies)
Discussion started by: dmilks
8 Replies

2. Shell Programming and Scripting

Testing VPN Connection

Hi All: I need a script that can be timed to run every half hour to an hour to run a traceroute through a VPN to test that a connection is still up from a Win XP system. Which would be the best, C++ or Perl and what are some good resources to look at. (If anyone has a script to do this... (1 Reply)
Discussion started by: maxhewitt
1 Replies

3. Solaris

Testing physical network connection

How do you test the physical network connection of an interface in solaris. I know that if you have an active connection and the cable gets yanked, you can look in the messages file to check for link failure messages. But is there any better way to see if you have good layer 2 connectivity? (1 Reply)
Discussion started by: tjlst15
1 Replies

4. UNIX for Dummies Questions & Answers

ssh_exchange_identification: Connection closed by remote host Connection closed

Hi Everyone, Good day. Scenario: 2 unix servers -- A (SunOS) and B (AIX) I have an ftp script to sftp 30 files from A to B which happen almost instantaneously i.e 30 sftp's happen at the same time. Some of these sftp's fail with the following error: ssh_exchange_identification: Connection... (1 Reply)
Discussion started by: jeevan_fimare
1 Replies

5. UNIX for Advanced & Expert Users

Connection reset by peer..closing connection

Hello I'm facing the above problem while doing a performance run. I've a script which I'm launching from my windows desktop using mozilla. The script will invoke backend action on a Solaris host which in turn feeds the records to a driver located on a linux box(Cent OS). What's happening is... (1 Reply)
Discussion started by: subramanyab
1 Replies

6. Shell Programming and Scripting

Testing connection with a script

I have a box that has to start dhcpd when a certain connection is down and stop the dhcpd when the connection is up again. I would appriciate any help making this script: From server A: ping server B if connection is ok then do nothing if connection is not ok then start dhcpd until... (8 Replies)
Discussion started by: KimJensen
8 Replies

7. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

8. Shell Programming and Scripting

testing postgres connection in shell script

I have a script that does db query in postgres. I'm trying to put in some error checking in the script. I keep running into the password prompt problem where when invalid credentials/or database is put it, it would prompt me for a password which hangs the script. Is there a way that I can check for... (0 Replies)
Discussion started by: zerofire123
0 Replies

9. UNIX for Advanced & Expert Users

How keep running a program n an another computer via a connection ssh when the connection is closed?

Hi everybody, I am running a program on a supercomputer via my personal computer through a ssh connection. My program take more than a day to run, so when I left work with my PC I stop the connection with the supercomputer and the program stop. I am wondering if someone know how I can manage... (2 Replies)
Discussion started by: TomTomGre
2 Replies

10. IP Networking

Get DHCP relay interfaces IP address using DHCP

Hi All , please view the set up below: ------------------------------------------------------------------- | DHCP Server |-----------| ROUTER & |-----------| Clients | | 192.168.99.1 | - -<eth1>| DHCP-RELAY|<eth2>-- | 192.168.88.X | ... (2 Replies)
Discussion started by: gdangoor
2 Replies
IFUP(8) 						       Network configuration							   IFUP(8)

NAME
ifup - start a pre-configured network interface. ifdown - stop a (pre-configured) network interface. ifstatus - show the state of a (pre-configured) network interface. ifrenew - renews the dhcp lease on a network interface. ifprobe - checks if the configuration for the interface has changed SYNOPSIS
if{up,down,status,renew,probe} [ <configuration-name> ] <interface> [-o options ] NOTATION
We use the terms configuration, interface and device in a dedicated way. A device is always a piece of hardware representing a network interface, a PCI or PCMCIA card or a USB device. An interface then is the name of the network interface it gets from the kernel, when the device has been registered. A configuration is a set of parameters which can be assigned to an interface like IP addresses or routes. DESCRIPTION
ifup is used to bring up a pre-configured interface for networking. It is usually invoked by the network script at boot time or by the PCM- CIA/hotplug system. It can also be used to start interfaces manually on the command line. It activates the link, adds addresses and other parameters and sets up the routes for an interface. ifdown is used to set down the interface and flush all its addresses. It is possible to let ifdown check the interface if it is still used before setting it down. If configured it may then get rid of the using processes or refuse setting it down. Have a look at /etc/syscon- fig/network/config to enable this feature. ifstatus checks if the interface and its routes were set up properly. ifrenew is used to renew the dhcp lease on the desired interface without shutting the interface down. It only restarts the corresponding dhcpcd or dhclient process. ifprobe checks if any of the configuration files for this interface have been changed since the interface is up. Checked files are the cor- responding ifcfg-*, ifroute-*, ifservices-* and common configuration files config, dhcp and routes. <interface> is the network interface name. The network interface names of physical network devices are assigned by the kernel and may be modified by udev(7) rules; see the PERSISTENT INTERFACE NAMES section. <configuration-name> is the optional parameter with the name of a configuration, that should be used to set up the interface. Every config- uration is stored in files below /etc/sysconfig/network which are named ifcfg-<configuration-name>. By default, the interface name is used as configuration name. The parameter exists for compatibility reasons, but may be also used to circumvent this fixed relation. PERSISTENT INTERFACE NAMES
The support for persistent interface names for physical network devices using ifcfg-<hardware-description> configuration files is removed from sysconfig since openSUSE 10.3. Instead, an automatic assignment of persistent interface names is implemented using udev(7) rules. When a network device driver is loaded, the kernel assigns the next currently free interface name to it. For built-in devices there is most of the time a fixed relation between devices and interfaces, but this is no longer the case when using hot-pluggable devices. With such devices (like PCMCIA or USB) you cannot always know which interface name it will get - it depends for example on the order the devices got plugged in. The network interface assigned in the kernel is reported to the udev daemon. When a device appears the first time, the udev persistent net generator rule creates a rule matching the device, by default using the hardware (MAC) address, that renames the interface name assigned by the kernel to one, that is not used in any another rule and thus unique for the device. This rule is appended to the persistent net rule file and executed. When the same device appears in the system next time, the generated rule renames the interface to the persistent name again. The generated persistent interface name rules can be adopted in yast2 network module or by editing the rule file directly. Currently, they are stored in the /etc/udev/rules.d/70-persistent-net.rules udev rule file. OPTIONS
The following are options to be specified after the -o switch. auto Only set up the interface if the configuration has the STARTMODE=auto (or boot, onboot or hotplug.) [on]boot Alias for 'auto'. hotplug Like auto, but do some extra jobs, because hotplug indicates that the interface was just (un)registered. These extra jobs contain (if configured): starting/stopping ifplugd, renaming interface and removing all status files at ifdown. manual This is default operation mode and sets up interfaces with STARTMODE=manual. If option 'rc' is used which implies mode 'auto', you can force mode 'manual'. rc Special option for the use in rcnetwork (/etc/init.d/network). See section rcnetwork below. dhcp Indicates that script is called from dhcp client. When a interface has BOOTPROTO=dhcp ifup/down does not execute any post action immediately. After dhcp client got a lease and has set ip address, it calls ifup again, this time with option 'dhcp'. In this run we finish interface setup. nodeps If there are interfaces based on this interface, ifdown takes these depending interfaces down first. If you don't like that, use 'nodeps'. prov=<n> Use provider <n> instead that from config file. Only usefull for dialup interfaces. debug Be verbose. (no)syslog With nosyslog the scripts don't send messages to syslog even if the configuration variable USE_SYSLOG is set to "yes". This is default for ifstatus only. If you want also ifstatus messages send to syslog then call it with syslog. FILES
/sbin/ifup The script itself. /etc/sysconfig/network/config General configuration options. See section GENERAL VARIABLES below. /etc/sysconfig/network/ifcfg- <configuration-name> The files containing the configuration of the devices. An example that shows a typical configuration with the name ifcfg-eth0: IPADDRESS=10.10.11.184 NETMASK=255.255.0.0 BROADCAST=10.10.255.255 STARTMODE=onboot /etc/sysconfig/network/ifroute- <configuration-name> You can specify individual routes for every configuration in these files. See routes (5) for a detailed description. /etc/sysconfig/network/if-{up,down}.d/ Scripts in these directories will be executed when any interface is started, if-up.d, and when any interface is stopped, if-down.d. They have to be executable and may also be binary. The execution of these programs is controlled by the variables GLOBAL_POST_UP_EXEC and GLOBAL_PRE_DOWN_EXEC in the network configuration file /etc/sysconfig/network/config These are not interface specific, and can have any name. If you need interface/configfile specific scripts to be executed have a look at PRE_UP_SCRIPT, POST_UP_SCRIPT, PRE_DOWN_SCRIPTand POST_DOWN_SCRIPT. /etc/sysconfig/network/ifservices- <configuration-name>/ If you don't have a permanent network connection and like that certain services are not started at boot time unconditionally but later after the network connection was established then you can add these services here. See ifservices (5) for a detailed descrip- tion. /etc/sysconfig/network/ifcfg.template A template for writing ifcfg-* files. GENERAL VARIABLES
There are some general settings in the file /etc/sysconfig/network/config. If needed you can also set every general variable as an indi- vidual variable in the ifcfg-* files. Please see the description of these variables in /etc/sysconfig/network/config. For dhcp there are additional global options in /etc/sysconfig/network/dhcp. Also these are described there and can be used individually in ifcfg-* files. rcnetwork (/etc/init.d/network) At boot time network devices are initialized asynchronously via hotplug. Once this initialization process registered an interface for it this will also trigger a hotplug event which will call ifup. If service network was still not started ifup will just exit. As soon as ser- vice network is active ifup will do its job and set up the interface. Therefore the job of the network start script consists of: - set the 'network active' flag - set up all interfaces already available - wait for mandatory interfaces which are still not there - set up tunnel, vlan, et al. At boot time the scripts tries to determine the list of mandatory devices automatically. It considers all interfaces that have a startmode 'auto' or 'onboot' as mandatory. Normally it waits 20 seconds for them and exits then with failed is any mandatory interface is still miss- ing. Alternatively you may specify all mandatory devices manually in the variable MANDATORY_DEVICES in the file. /etc/sysconfig/network/config. There you may also tweak the timeout in WAIT_FOR_INTERFACES. The network script will only set up devices with with startmodes auto, onboot or hotplug. To set up an interface with startmode manual you have to call ifup manually. (rcnetwork calls 'ifup ... -o rc'). DIAGNOSTICS
ifstatus interface ifup and rcnetwork write status files in /dev/.sysconfig/network. If something went completely wrong this files might be interesting. BUGS
Please report bugs at <http://www.suse.de/feedback> AUTHOR
Christian Zoz <zoz@suse.de> -- ifup script Michal Svec <msvec@suse.cz> -- ifup script Bjoern Jacke -- ifup script Mads Martin Joergensen <mmj@suse.de> -- ifup manual page Michal Ludvig <mludvig@suse.cz> -- tunnel support SEE ALSO
ifcfg(5), routes(5), ifservices(5), ifcfg-wireless(5), ifcfg-tunnel(5), ifcfg-vlan(5), ifcfg-bonding(5), getcfg(8). sysconfig August 2004 IFUP(8)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy