Dhcp

Discussion in 'Server Operation' started by kirim, Aug 14, 2007.

  1. kirim

    kirim New Member

    new to linux, need help on DHCP
    i have one machine with two Nic on, eth0 has a public ip and eth1 for DHCP
    DHCP installed and able to assign IP address to PCs in my network. Pinging my default gateway on eth1 is not responding or reply ... what seems to be the problem... appreciate any ideas to try:confused:
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's your gateway, eth0 or eth1? What's the output of
    Code:
    ifconfig
    ? What's the ping command you used?
     
  3. kirim

    kirim New Member

    Dhcp using Ubuntu

    thanks my ifconfig is as follows

    root@ienserver:/home/adminim# ifconfig
    eth0 Link encap:Ethernet HWaddr 00:17:31:7B:35:02
    inet addr:202.43.9.64 Bcast:202.43.9.255 Mask:255.255.255.0
    inet6 addr: fe80::217:31ff:fe7b:3502/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:58804 errors:0 dropped:0 overruns:0 frame:6534
    TX packets:3171 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:7567275 (7.2 MiB) TX bytes:532504 (520.0 KiB)
    Interrupt:19 Base address:0xd000

    eth1 Link encap:Ethernet HWaddr 00:08:A1:A3:47:30
    inet6 addr: fe80::208:a1ff:fea3:4730/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 b) TX bytes:4321 (4.2 KiB)
    Interrupt:20 Base address:0xc800

    eth1:avah Link encap:Ethernet HWaddr 00:08:A1:A3:47:30
    inet addr:169.254.5.64 Bcast:169.254.255.255 Mask:255.255.0.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    Interrupt:20 Base address:0xc800

    :)
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What about my other questions?

    Your eth1 has an IPv6 address only, no IPv4 address. I think that could be the cause of your problem.
     
  5. kirim

    kirim New Member

    using ping

    eg ping 192.168.0.1

    ok how will i enable ipv4 then...please advise cos i really need to get
    this going...much thanks
     
    Last edited: Aug 17, 2007
  6. falko

    falko Super Moderator Howtoforge Staff

    I don't see that IP address in the output of ifconfig...

    What's in /etc/network/interfaces and /etc/hosts?
     
  7. kirim

    kirim New Member

    i am using Ubuntu 7.04 Fiesty Fawn
    thanks this is my network interfaces
    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    iface eth0 inet static
    address 202.43.9.64
    netmask 255.255.255.0
    gateway 202.43.9.1

    # The Local Network for Clients
    iface eth1 inet dhcp

    And this is my host
    127.0.0.1 localhost.localdomain localhost
    202.43.9.64 ienserver.matangiake.to ienserver.matangiake.to


    # The following lines are desirable for IPv6 capable hosts
    #::1 ip6-localhost ip6-loopback
    #fe00::0 ip6-localnet
    #ff00::0 ip6-mcastprefix
    #ff02::1 ip6-allnodes
    #ff02::2 ip6-allrouters
    #ff02::3 ip6-allhosts
    :confused:
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Hm... And where does the eth1:avah device come from?
     
  9. kirim

    kirim New Member

    the eth1:avah device is one of the features in the Network Settings..one for Static, DHCP and Local Zeroconf Network (IPv4 LL) when i selected the Local Zeroconf Network the eth1:avah device appeared as one of the output using ifconfig.... as shown in the previous thread.

    I want eth1 to distribute IP to my local network but i cannot. in my network interface conf i configured eth1 with the pool of IPs but still could not work to distribute ips ... any idea.. please advise
    thanks
     
  10. falko

    falko Super Moderator Howtoforge Staff

    Can you try to assign a static IP to eth1? What's the output of
    Code:
    ifconfig
    then?
     
  11. kirim

    kirim New Member

    thanks

    i put static ips on the eth1 and now the ifconfig output is as follows;

    root@ienserver:/home/adminim# ifconfig
    eth0 Link encap:Ethernet HWaddr 00:17:31:7B:35:02
    inet addr:202.43.9.64 Bcast:202.43.9.255 Mask:255.255.255.0
    inet6 addr: fe80::217:31ff:fe7b:3502/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:9915 errors:0 dropped:0 overruns:0 frame:91
    TX packets:5759 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:9209914 (8.7 MiB) TX bytes:625554 (610.8 KiB)
    Interrupt:19 Base address:0xd000

    eth1 Link encap:Ethernet HWaddr 00:08:A1:A3:47:30
    inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
    inet6 addr: fe80::208:a1ff:fea3:4730/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:101 errors:0 dropped:0 overruns:0 frame:0
    TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:15652 (15.2 KiB) TX bytes:4008 (3.9 KiB)
    Interrupt:20 Base address:0xc800

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:4 errors:0 dropped:0 overruns:0 frame:0
    TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:168 (168.0 b) TX bytes:168 (168.0 b)

    root@ienserver:/home/adminim#
     
  12. kirim

    kirim New Member

    ok..

    now my pc can get its ip from the DHCP server but cannot ping my gateway
    192.168.0.1 or connect to the internet.

    i guess my dhcp is working with the result shown below

    root@ienserver:/home/adminim# /etc/init.d/dhcp3-server restart
    * Stopping DHCP server dhcpd3 [ OK ]
    * Starting DHCP server dhcpd3 [ OK

    what should i do to connect my pc to the internet..thanks:)
     
  13. falko

    falko Super Moderator Howtoforge Staff

    Is 192.168.0.1 a system/router of its own?

    What's in /etc/network/interfaces now? What's the output of
    Code:
    route -nee
    ?
     
  14. kirim

    kirim New Member

    out for /etc/network/interfaces is at below;
    # 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
    iface eth0 inet static
    address 202.43.9.64
    netmask 255.255.255.0
    gateway 202.43.9.1

    # The Local Network for Clients
    iface eth1 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1

    auto eth1

    auto eth0
    ~
    "/etc/network/interfaces" 22 lines, 461 characters

    output for route -nee is as below;

    root@ienserver:/etc/network# route -nee
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface MSS Window irtt
    202.43.9.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0 0 0
    192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0 0 0
    169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth1 0 0 0
    0.0.0.0 202.43.9.1 0.0.0.0 UG 0 0 0 eth0 0 0 0
    0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth1 0 0 0
    root@ienserver:/etc/network#

    thaks let me know what to do next...still can not ping my gateway or go on the internet...i got my IPs thou from dhcp....
     
  15. soroccoheaven

    soroccoheaven New Member

    verify your option router in dhcpd.conf it should be 192.168.0.1;
    and see the messasges cat /var/log/messages

    and check your ip forwarding status:

    In /etc/sysctl.conf make net.ipv4.ip_forward = 1
     
  16. falko

    falko Super Moderator Howtoforge Staff

    Are you sure your gateway has the IP 192.168.0.1?
     
  17. kirim

    kirim New Member

    i have done all of the stuff in the last thread and still cannot connect to the internet...

    for your info,,,
    well, i only have one PC with two NiCs, i don't have a router therefore i use eth0 for my internet connection and i want eth1 for DHCP. The default gateway i am talking about here is the one i put in eth1 and it is the same one on the dhcp.conf as well... eth0 has a public ip and eth1 i use a private ip 192.168.0.0
    DHCP is working but cannot ping any ip...
    so from here i don't know whether the way i think will work or not for having eth1 distributing ip... i have linux box and my clients are windows will this cause the problem for not accessing the internet. I also have samba installed..

    appreciate any idea..
    :confused:
     
  18. soroccoheaven

    soroccoheaven New Member

    well.. i am not a GURU ..where did you get this 192.168.0.1 ???....is this IP address given to any of your interface ?..you havent done so ..as you said you are having 2 NIC one with static ip and other from local poool right ?....you gave 192.168.0.2 to 2nd NIC with gateway 192.168.0.1 ..what about this 192.168.0.1 ..any interface having this IP address in network ?....
    you can try this and i am sure it will wotk for you ..

    Is this done ?..
    edit this : /etc/sysctl.conf and make net.ipv4.ip_forward = 1

    change the ip address of 2nd NIC to 192.168.0.1 and default gateway 202.43.9.1 on eth1 so in dhcpd.conf you have to define your range from 192.168.0.2 to whatever you need .

    and run /etc/init.d/network restart and /etc/init.d/dhcpd restart

    verify from cat /var/log/messages

    and Finally if isnt working pls post output of this :

    /etc/sysconfig/network-scripts/ifcfg-eth0 and
    /etc/sysconfig/network-scripts/ifcfg-eth1

    Now you should be able to ping all the node as well as internet.
     

Share This Page