Slashdot Mirror


Is it possible to ARP address a Linux box?

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! "

10 comments

  1. Seems like you have a clue. by Anonymous Coward · · Score: 0

    man arp

  2. arp -s and Linux by Anonymous Coward · · Score: 0

    arp -s doesn't set a remote computer's address,
    what it does is to pre-load the address cache of the local computer with the IP and MAC address of the remote computer.

    You will still have to set the IP address of the Linux machine, using ifconfig as usual.

    Newer Linux distributions are very easy to set up for networking - so really, even if you are preloading Linux on a number of machines, issuing an IP address for them on first boot isn't much work.

    Anonymous 'cause the login account is at the office.

  3. Which IP address for solution 4 by Anonymous Coward · · Score: 0

    It should not matter a lot what IP address you use, if you want to be sure you don't collide with a known private address just use a public one like 206.170.14.75.

    This only means the installer's PC can't reach slashdot for a while (he can 'route del' afterward and all will be well again). You probably could even use something like 1.2.3.4. After the initial install the Linux server will stop using the address anyway, so there should be no realistic chance of trouble because of this.

    What kind of system will you be using this for BTW?

  4. Multiple IPs on same network device by Anonymous Coward · · Score: 0


    You have a machine at 192.168.10.1 on device eth0.

    ifconfig eth0:1 192.168.10.2
    route add -host 192.168.10.2 dev eth0:1

    Then you can ping yourself at two different IPs. The process can be repeated with eth0:2, :3, etc.

  5. "arp addressing" (Original poster) by timw · · Score: 1

    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.

  6. Userland trickery by bgarrett · · Score: 1

    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?

    --
    Nothing worth doing is worth doing today.
  7. Not an answer, but a clarification of the question by Tripp+Lilley · · Score: 1

    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.

  8. "arp addressing" by monta · · Score: 1

    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.

  9. A brief summary of the possible ways to do it that by Dowser · · Score: 1

    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

  10. Solution with tcpdump and bash... by ce · · Score: 1

    #!/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