This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using static address with DHCP server

Hi,

Keil Ethernet stack

I have trouble using static address when If I cannot find DHCP Server.
I enable Dynamic Host Configuration in Net_Config_ETH_0.h
I also specified my static ip address==192.168.0.100 and static Default Gateway =192.168.0.1.
Primary DNS Gateway =192.168.0.1.

I am connecting directly my Embedded device ethernet to PC.
My PC has static IP address = 192.168.0.1

If I disable Dynamic Host Configuration in Net_Config_ETH_0.h then it all works.

I thought If it cannot find DHCP server it will fallback back to using static DNS server which is my PC.

Kindly suggest what is wrong with my configuration. Does Keil Ethernet stack supports fallback?

Thanks,
Naeem

Parents
  • Why do you need that?

    If you buy a networked printer, then the printer has a setting to enable DHCP. Or to set a fixed IP. Not to do both. Your mobile phone normally only supports DHCP unless you use developer mode - in which case you can set a fixed IP but not together with DHCP.

    What you want is an automatic teller machine that, if it fails to contact the bank to verify your card should fallback to give you many anyway.

    The only devices I know of that makes use of "fixed" IP if they don't get any DHCP allocation are instead making use of automatic analysis of the network to try to detect the gateway and all IP number in use. And this involves a number of patents which makes it a bit tricky to implement in own devices except for hobby use.

    The traditional way a NAS or networked camera handles the situation in networks without a DHCP server is that the customer gets a management tool that you run on a computer. This tool locates all MAC addresses on the network segment and compares with the MAC address range allocated to that manufacturer. Then the tool allows the customer to specify a fixed IP and send to the NAS/camera/...

    Sometimes, what "you need" isn't what you should do, because it's the wrong thing. A bad idea to stay away from.

    If I connect a cable from your device to a local switch on my table - but haven't connected the switch to the office network - then your device will see a network link. But it will not find any DHCP server. So it will then make the assumption that it's ok to switch over to your fixed IP number. But then I connect the network cable from my local switch into the office network. And suddenly I have a hostile device making use of an IP number that might have already been allocated to something else. So maybe your device then steals the IP from the office printer. You think people will be happy when the printer suddenly stops working?

    When you use your device in your own, private, network you can do whatever you like. But then you don't need any auto-failover since you are already the master of the IP number range. When you bring your device into someone else's network, then it isn't any longer your choice what you think is a good idea. Then you'll have to settle for what the network owners things is a good idea. Have you seen many RFC texts with the message "just take an IP number if no DHCP server wants to hand over an IP?"

    Remember that in some networks, there may be DHCP servers that are configured to ignore any device not in their white list. The IT admin don't want any equipment to get any IP unless having explicitly white-listed the device and specified exactly what parts of the network and network traffic that should be visible. So not receiving an IP number isn't the same as the network not having a DHCP server.

Reply
  • Why do you need that?

    If you buy a networked printer, then the printer has a setting to enable DHCP. Or to set a fixed IP. Not to do both. Your mobile phone normally only supports DHCP unless you use developer mode - in which case you can set a fixed IP but not together with DHCP.

    What you want is an automatic teller machine that, if it fails to contact the bank to verify your card should fallback to give you many anyway.

    The only devices I know of that makes use of "fixed" IP if they don't get any DHCP allocation are instead making use of automatic analysis of the network to try to detect the gateway and all IP number in use. And this involves a number of patents which makes it a bit tricky to implement in own devices except for hobby use.

    The traditional way a NAS or networked camera handles the situation in networks without a DHCP server is that the customer gets a management tool that you run on a computer. This tool locates all MAC addresses on the network segment and compares with the MAC address range allocated to that manufacturer. Then the tool allows the customer to specify a fixed IP and send to the NAS/camera/...

    Sometimes, what "you need" isn't what you should do, because it's the wrong thing. A bad idea to stay away from.

    If I connect a cable from your device to a local switch on my table - but haven't connected the switch to the office network - then your device will see a network link. But it will not find any DHCP server. So it will then make the assumption that it's ok to switch over to your fixed IP number. But then I connect the network cable from my local switch into the office network. And suddenly I have a hostile device making use of an IP number that might have already been allocated to something else. So maybe your device then steals the IP from the office printer. You think people will be happy when the printer suddenly stops working?

    When you use your device in your own, private, network you can do whatever you like. But then you don't need any auto-failover since you are already the master of the IP number range. When you bring your device into someone else's network, then it isn't any longer your choice what you think is a good idea. Then you'll have to settle for what the network owners things is a good idea. Have you seen many RFC texts with the message "just take an IP number if no DHCP server wants to hand over an IP?"

    Remember that in some networks, there may be DHCP servers that are configured to ignore any device not in their white list. The IT admin don't want any equipment to get any IP unless having explicitly white-listed the device and specified exactly what parts of the network and network traffic that should be visible. So not receiving an IP number isn't the same as the network not having a DHCP server.

Children