Find the answer to your Linux question:
Results 1 to 2 of 2
Edit: Since posting this I've come to understand a little more...OpenWRT uses udhcpc to make requests...by using the command udhcpc -i eth1 I'm able to request an ip from my ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    13

    "ip" command / Multiple public IP's


    Edit: Since posting this I've come to understand a little more...OpenWRT uses udhcpc to make requests...by using the command udhcpc -i eth1 I'm able to request an ip from my ISP...unfortunately it always returns the same IP...so I'm not sure how to get it to return to me a new one. Once I figure that out I can write a script to request the IP, then use ip addr add etc etc. At least that's what I'm thinking....

    Ok...So I'm in a little over my head at this point, so I apologize ahead of time if my descriptions of the situation are not the best, but here goes.

    I have a router, this router is running OpenWRT, an embedded linux router distro. I have recently requested a second IP address be allocated to me from my ISP. Now the addresses they provide are of course not static, so I have to DHCP to get them. Keeping in mind this is a router my tools and configurations are somewhat limited. Now through a bunch of investigating, and a little help it appears the tool "ip" (ip-cref Contents) should be able to do what I need it to do. I have it installed..but for the life of me I can't figure out what I'm supposed to do with it.

    Making matter slightly more complicated (for anyone already familiar with openwrt) I'm running a router that uses a slightly different configuration than most other routers. I actually have 3 network interfaces active, eth1 (WAN), eth0 (4 port LAN switch), and eth2 (actually the Wifi). To be a little more specifi if there happen to be any hardcore openwrt users...I'm using an Asus WL-500W.

    the command I need (at least to start with) I think should be something like: "ip addr add dev eth0 label eth1:1" Now this isn't complete nor is it probably 100% right for the parts I have even...I'm hoping someone here with more networking knowledge might be able to help get me out of this hole.


    Summary:

    Basically I have a network interface card facing the internet. I want this interface to pull 2 ip's via DHCP. I'm limited on tools and configurations...I don't have much networking knowledge. After I figure out how to deal with getting the two ip addresses I need to work out how to use the route commands to handle getting the correct request to the correct computer.

    If you need any diagnostics let me know and I'll be happy to provide them...but I'm not sure what is need, but I'll list two likely ones ip a and ifconfig

    ip a:
    1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    2: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:1a:92:bb:6d:66 brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:1a:92:bb:6d:66 brd ff:ff:ff:ff:ff:ff
    inet 68.231.167.78/24 brd 68.231.167.255 scope global eth1
    4: br-lan: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
    link/ether 00:1a:92:bb:6d:66 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br-lan
    5: wl0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:1a:92:bb:6d:66 brd ff:ff:ff:ff:ff:ff
    6: imq0: <NOARP> mtu 1500 qdisc noop qlen 30
    link/void
    7: imq1: <NOARP> mtu 1500 qdisc noop qlen 30
    link/void

    ifconfig:
    br-lan Link encap:Ethernet HWaddr 00:1A:92:BB:6D:66
    inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:50802 errors:0 dropped:0 overruns:0 frame:0
    TX packets:39081 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:4279047 (4.0 MiB) TX bytes:11488160 (10.9 MiB)

    eth0 Link encap:Ethernet HWaddr 00:1A:92:BB:6D:66
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:9401 errors:0 dropped:0 overruns:0 frame:0
    TX packets:8695 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:1325120 (1.2 MiB) TX bytes:6220926 (5.9 MiB)
    Interrupt:4

    eth1 Link encap:Ethernet HWaddr 00:1A:92:BB:6D:66
    inet addr:68.231.167.xxx Bcast:68.231.167.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:130930 errors:0 dropped:0 overruns:0 frame:0
    TX packets:47554 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:17959851 (17.1 MiB) TX bytes:4860796 (4.6 MiB)
    Interrupt:5

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:127 errors:0 dropped:0 overruns:0 frame:0
    TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:9269 (9.0 KiB) TX bytes:9269 (9.0 KiB)

    wl0 Link encap:Ethernet HWaddr 00:1A:92:BB:6D:66
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:41673 errors:0 dropped:0 overruns:0 frame:140018
    TX packets:32525 errors:18 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:3736807 (3.5 MiB) TX bytes:6120718 (5.8 MiB)
    Interrupt:2 Base address:0x4000

  2. #2
    Just Joined!
    Join Date
    Jan 2007
    Posts
    13
    Ok...So I've made a ton of progress. In order to get the second IP I do as follows:

    ip addr add dev eth1 label eth1:1 0.0.0.0
    udhcpc -i eth1:1

    With that I get two different ip's assigned to the interface and subinterface of eth1...next step read up on routes. So I can figure out how to get the correct IP's forwarded to the correct computers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •