Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Linux Software

Is it possible to ARP address a Linux box? 10

Markus Reimer asks: "Is it possible to ARP address a Linux box in the same way you can ARP address som printservers and similar 'network boxes'? The thing I want to accomplish is setting an ip-address on a Linux box, remotely, when the box is first set up. (preinstalled Linuxsystem). On several print-server boxes you do this by using arp (e.g. arp -s 192.168.17.42 ff:ff:ff:ff:ff:ff) If I could do this it would be great! "
This discussion has been archived. No new comments can be posted.

Is it possible to ARP address a Linux box?

Comments Filter:
  • 2.1 kernels have a 'PnP IP' option (or something). Turn that on. It will use rarp, which I expect is what you mean. Have rarpd running on another machine and use rarp to set the IP address.
  • Or you could bring up eth0 on a known fake address (pick something highly random in 10.0.0.0) and start up tcpdump -i eth0 -p -n -e, use perl to hunt for a matching MAC address (available from ifconfig), then ifconfig your card back up using the "real" IP. Ugly, but hey. Isn't this functionality what reverse-ARP is for?
  • What the original poster describes is a 'clever' method used by Axis and other manufacturers of embedded IP products.

    What you do is force the IP address of the device into the arp cache of another machine on the same network (using arp -s under Win32, arp pub under *nix). Then, you put the new embedded system on the network and ping it from the machine whose arp cache you stuffed. The embedded system, meanwhile, is listening for any Ethernet frames with its MAC. When it sees them, it peels them apart and looks for the destination IP. It assumes that the destination IP is its own, and configures itself appropriately.

    The reasons for this approach are simplicity, hardware reduction, and code size:

    1) The user of the device doesn't need a DHCP server, and doesn't need to flip any jumpers or anything.

    2) The manufacturer doesn't have to write a DHCP client (which has a bunch of state code that is no fun to code in asm), and doesn't have to add extra hardware to the device just to support configuration (ie: switches, buttons, LCDs or LEDs or whatever).

    However, I do not know of an implementation for this trick under Linux. It's within the realm of theoretical possibility, though I don't believe you'll find anyone in the "big" Linux world rushing to implement it when DHCP is fairly easy to do.

    You might have some success in the ucLinux world, but it sounds like you want to use this to address workstations. What is your actual goal? What are your constraints, and why? Perhaps we could suggest an alternative if we had more background on the /actual/ problem, not the final technical issue.
  • man dhcpd

    The Internet Software Consortium DHCP Server, dhcpd,
    implements the Dynamic Host Configuration Protocol (DHCP)
    and the Internet Bootstrap Protocol (BOOTP). DHCP allows
    hosts on a TCP/IP network to request and be assigned IP
    addresses, and also to discover information about the net-
    work to which they are attached. BOOTP provides similar
    functionality, with certain restrictions.
  • 1 Set the IP manually, using keyboard and monitor

    2 Use BOOTP or DHCP

    3 Configure the server via floppy

    4 Pre set the IP and make a staic host route (and some ipfwadm scripting)

    5 Hack the kernel

    1) The crude and effective way out.
    Works, but isn't a attractive solution, since it depends on the installer being capable to handle more than a webbrowser...

    2) I rather don't...
    I don't want to intrefer with the customers network to much, introdusing extra network services is definitely one of those things that I shuld avoid...

    3) making a simple win (or whatever) program to create a config file on a floppy that are searched for at every new floppy is a easy way but is a obvious security hasard.

    4) It's a nice solution, and probably the most appealing yet, but wich adress shuld I use as a default, not anyone of the private internet's, many of our customers use them now...

    5) Culd anyone give me a estimated time for making a module for this?
    If You have the time and expertise to create this I culd check for the financial room to develop this and ofcause release it GPL!

    Are there any other approach that I have overseen?

    Kind Regards
    //Markus Reimer
  • #!/bin/sh
    MAC=`ifconfig eth0 |awk '/HWaddr/ {print $5}'`
    IP=`tcpdump -nc1 ether dst $MAC and icmp[0]=8 |awk '/echo request/ {sub(":","",$4);print $4}'`
    echo $IP

"When the going gets tough, the tough get empirical." -- Jon Carroll

Working...