vanheusden.com

At the Lotter you can participate in lotteries of other countries than where you live in! Very convenient!

MyIP

MyIP is an IP stack in userspace.

It will listen on a tap-, promiscuous, slip or ppp device for network frames containg e.g. ARP-requests, IP packets, ICMP(6), UDP and even NTP, VNC, SIP, MQTT and HTTP requests. Also LLDP, NDP, Socks, syslog, PPP, SLIP, NRPE, DNS (client), SCTP, MDNS and SNMP. When multiple interfaces are configured, it can also route between them.

I wrote MyIP to see how difficult it is to writen an IP-stack. Maybe it is of use to anyone?

Source code: on GitHub

how I test it

Below are my notes on how my test-setup looks like. It is made up of 3 computers connected via LAN/serial-PPP links. This to give you an idea how to configure it and what can be done with it.

M: management
T0: uplink MyIP
T1: test network between MyIP and testhost
T2: test network between testhost1 and routed testhost2


laptop
 |
 |
LAN-----------------+ MyIP host
192.168.64.0/23 (M) +-LAN0: 192.168.64.200/23 (M)
52:54:00:86:d9:1f   |       dc:a6:32:6f:80:84
GW:192.168.64.1     +-LAN1: 192.168.65.11/23 (T0)
                            00:0e:c6:f0:41:37
                      LAN2: 192.168.7.1/24 (T3) -------------------------------+
                            00:e0:98:61:a3:69                                  |
                   +--MyIP: 192.168.5.1/24 (T1) [/dev/ttyUSB0]                 |
                   |  RS232                                                    |
                   |                                                           |
                   |                                                           |
                   |  testhost1                       testhost2 (arduino)      |
                   |  WLAN:  192.168.65.10/23 (M)     192.168.6.2 (T2)         |
                   |         dc:a6:32:06:ee:a3        00:aa:bb:cc:da:02        |
                   +--RS232: 192.168.5.2/24 (T1) [/dev/ttyUSB0]   |            |
                      LAN0:  192.168.6.1/24 (T2) -----------------+            |
                             dc:a6:32:06:ee:a2                                 |
                      LAN1:  192.168.7.2/24 (T3) ------------------------------+
                             00:e0:98:61:a3:5c

MyIP host:
 $ cd /root/MyIP
 $ ./build/myip ../myip-test.cfg
 
testhost1:
 $ pppd nodetach noauth debug nocrtscts defaultroute /dev/ttyUSB0 115200
   > nodetach / debug: do not fork & show debug info
   > noauth: myip does not do authentication on PPP
   > nocrtscts: my test serial cable only has GND/RX/TX connected

laptop:
 $ route add -net 192.168.5.0/24 gw 192.168.65.11
 $ route add -net 192.168.6.0/24 gw 192.168.65.11
 $ route add -net 192.168.7.0/24 gw 192.168.65.11


myip-test.cfg (on MyIP-host)
----------------------------
logging = {
	file="myip.log";
	level_file="debug";
	level_screen="debug";
}

environment = {
	chdir-path="/tmp"
	run-as=0
	run-in=0

	ifup="/root/MyIP/go.sh"
	#ifdown=

	stats-socket="/tmp/myipstats.sock";

	n-router-threads=1;
}

interfaces = (
{
        type="promiscuous"

        dev-name="eth1"

        ipv4 = {
                n-ipv4-threads = 4;

		forwarder = true;
                
                my-address="192.168.65.11";
                gateway-mac-address="52:54:00:86:d9:1f";

                use-icmp=true;
                use-tcp=true;
                use-sctp=true;
                use-udp=true;

                n-icmp-threads=4;
                n-sctp-threads=4;
                n-tcp-threads=8;
                n-udp-threads=8;
        }       
                        
        # mac-address="56:6f:24:22:00:b2";
        mac-address="00:0e:c6:f0:41:37";

        routes = ( {
                        ip-family = "ipv4";
                        network = "192.168.64.0";
                        netmask = "255.255.254.0";
			priority = 1;
                },
		{
			ip-family = "ipv4";
			network = "0.0.0.0";
			netmask = "0.0.0.0";
			gateway = "192.168.64.1";
			priority = 0;
		} )
},
{
        type="promiscuous"

        dev-name="eth2"

        ipv4 = {
                n-ipv4-threads = 4;

		forwarder = true;
                
                my-address="192.168.7.1";
                gateway-mac-address="00:e0:98:61:a3:5c"; # mac of other side

                use-icmp=true;
                use-tcp=true;
                use-sctp=true;
                use-udp=true;

                n-icmp-threads=4;
                n-sctp-threads=4;
                n-tcp-threads=8;
                n-udp-threads=8;
        }       
                        
        mac-address="00:e0:98:61:a3:69";

        routes = ( {
                        ip-family = "ipv4";
                        network = "192.168.7.0";
                        netmask = "255.255.255.0";
			priority = 1;
		} )
},
{
	type="ppp"

	serial-dev="/dev/ttyUSB0";

	n-ipv4-threads=4;

	ipv4 = {
		my-address="192.168.5.1";

		forwarder = true;

		use-icmp=true;
		use-tcp=true;
		use-sctp=true;
		use-udp=true;
		n-icmp-threads=1;
		n-sctp-threads=1;
		n-tcp-threads=1;
		n-udp-threads=1;
	}

	mac-address="00:00:00:00:00:01";

	opponent-address = "192.168.5.2";

	n-ipv6-threads=1;

	routes = ({
			ip-family = "ipv4";
			network = "192.168.5.0";
			netmask = "255.255.255.0";
			priority = 1;
		},
		{
			ip-family = "ipv4";
			network = "192.168.6.0";
			netmask = "255.255.255.0";
			gateway = "192.168.5.2";
			priority = 1;
		})
})




At the Lotter you can participate in lotteries of other countries than where you live in! Very convenient!

For contact info, see this page.

Via GitHub: and via patreon you can sponsor me and my work.