
Hello Larry,
I have just purchased a Rabbit core module with Ethernet and I want to connect to the Internet. I don’t know much about TCP/IP. My PC on my network at work has these settings:
I want to set the Rabbit’s IP address to 192.168.1.100.
Is this a valid setting?
Richard P.
Hello Richard,
There is a big difference between a Valid IP address and a Good IP address.
Valid IP addresses are defined by the subnet mask which you can find explained here:
http://en.wikipedia.org/wiki/Subnet_mask
(You can also find “subnet mask calculators” on the web.)
Good IP addresses don’t conflict with other devices on your network.
I would be very careful about arbitrarily picking an IP address to use because this can incite violence from even your average mild-mannered network administrator if it ends up conflicting with your mail server. It would be very much like setting your cell phone number to the same number as the police department’s. You will get a lot of calls you don’t want and eventually you will receive a visit from a very angry person wanting an explanation. On the other hand, crashing a company-wide server is one way to increase your visibility within your organization.
Dynamic Host Control Protocol (or DHCP for short) is a much safer option. When your device connects to a DHCP server, the Rabbit module and the server chat for a moment and then the DHCP server assigns a valid address to the module. With DHCP, your network guy is making certain that the address won’t kill the network and you should be safe.
If the Rabbit module is connected to the debugger, your program can display a message in the STDIO window that will tell you what the dynamically assigned IP address is. (The sock_init_or_exit() function will print out the IP address by default.)
Often a DHCP server is a router or switch. The router will also probably have a list of which machines are assigned which IP address by MAC address, but this requires you to have administrator rights with the router to view the information. The best place to get information about your router and how to configure it is the router manufacturer’s website.
Setting up a test with two Rabbit devices
One way to test your network connection is to run a test with two Rabbit devices.
- Rabbit 1 - Runs PINGME.C with a fixed IP address provided to you by your IT guy.
- Rabbit 2 – Runs PINGYOU.C and is connected to Dynamic C and the debugger.
You can find both of these programs in the C:\DCRABBIT_XX.XX\Samples\TCPIP\ICMP directory and the comments provide instructions on how to run them.
Both devices are plugged into a router or switch and then you should be able to ping Rabbit 1 with Rabbit 2. Getting the network guy to help on this is a good idea because he’ll be able to help you avoid any of the pitfalls I described.
Putting together a test network
For long term TCP/IP development, I recommend setting up a test network where you can wreak havoc with no consequences. It can be as simple as a router without a connection to the larger network or something that your IT guys put together for you complete with a connection to the Internet. We use a secure test network at Rabbit and I wouldn’t dream of developing a network project on my company’s regular network. As a result, I get along very well with our IT department.
For more information on TCP/IP take a look at our TCP/IP User’s Manuals here:
http://www.rabbit.com/products/dc/docs.shtml
- Larry C.
Larry Cicchinelli is Rabbit’s Technical Support Manager. He has 30 years of embedded experience, and is considered one of the foremost authorities on Rabbit products. Larry and his staff offer comprehensive technical support to Rabbit customers.
Submit your questions for Larry via email at AskLarry@rabbit.com
Read more Ask Larry Answers
