C Code to get MAC Address and IP Address

Function in C to return the MAC Address:

Function in C to return the IP Address:

Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Finding a device IP Address

If you are developing software for an Ethernet (or Wifi) device, you’ll need to access the board for debugging and/or testing purpose. If your board does not have user interface or the serial port is not available, you’ll have to find the IP address (assuming it is using DHCP) before accessing the board thru telnet or ssh. A simple way to do that is to ping the broadcast address and check the arp table. > ping -b 192.168.0.255 WARNING: pinging broadcast address PING 192.168.0.255 (192.168.0.255) 56(84) bytes of data. 64 bytes from 192.168.0.246: icmp_seq=0 ttl=64 time=0.018 ms 64 bytes from 192.168.0.101: icmp_seq=0 ttl=64 time=0.217 ms (DUP!) 64 bytes from 192.168.0.246: icmp_seq=1 ttl=64 time=0.023 ms > arp -i eth0 arp -i eth1 Address                  HWtype  HWaddress           Flags Mask            Iface 192.168.0.103            ether   00:50:FC:00:00:01   C                     eth1 192.168.0.109            ether   00:13:20:01:01:01   C                     eth1 If you cannot find your device, it may be configured to […]

Linux LAN Port Scanner

Just a short post to show how to scan the open ports of a remote machine on the local network: sudo nmap -sS 10.10.10.123 Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2010-04-28 16:00 HKT Interesting ports on 10.10.10.123: (The 1660 ports scanned but not shown below are in state: filtered) PORT    STATE  SERVICE 69/tcp  closed tftp 139/tcp open   netbios-ssn 445/tcp open   microsoft-ds MAC Address: 00:50:FC:B1:E9:70 (Edimax Technology CO.) Nmap finished: 1 IP address (1 host up) scanned in 25.252 seconds Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Exit mobile version
UP 7000 x86 SBC