<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SLiRP &#8211; Virtually Fun</title>
	<atom:link href="https://virtuallyfun.com/category/slirp/feed/" rel="self" type="application/rss+xml" />
	<link>https://virtuallyfun.com</link>
	<description>Fun with Virtualization</description>
	<lastBuildDate>Thu, 17 Apr 2025 17:07:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>Using MIT PC/IP with SLiRP &#038; a virtual Cisco Router</title>
		<link>https://virtuallyfun.com/2024/03/25/using-mit-pc-ip-with-slirp-a-virtual-cisco-router/</link>
					<comments>https://virtuallyfun.com/2024/03/25/using-mit-pc-ip-with-slirp-a-virtual-cisco-router/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Mon, 25 Mar 2024 18:47:19 +0000</pubDate>
				<category><![CDATA[Dynamips]]></category>
		<category><![CDATA[pcap]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[videos]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=14177</guid>

					<description><![CDATA[In this video I&#8217;ll be covering the circa 1985 MIT PC/IP stack running on 86box trying to connect to a user mode network library, SLiRP. After that fails I&#8217;ll show how to break the stack apart so we can use &#8230; <a href="https://virtuallyfun.com/2024/03/25/using-mit-pc-ip-with-slirp-a-virtual-cisco-router/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="Using MIT PC/IP with SLiRP &amp; a virtual Cisco Router" width="584" height="329" src="https://www.youtube.com/embed/N3F-LOMDtJw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">In this video I&#8217;ll be covering the circa 1985 MIT PC/IP stack running on 86box trying to connect to a user mode network library, SLiRP. After that fails I&#8217;ll show how to break the stack apart so we can use WireShark to inspect the traffic, then how to replace the direct connection to SLiRP by using Dynamips to emulate a cisco 7200 router.</p>



<p class="wp-block-paragraph">Caution it&#8217;s all command line! </p>



<p class="wp-block-paragraph">I&#8217;ll cover adding a loop back adapter, installing WireShark, how to find the GUID&#8217;s of the interfaces, how to configure a HecNET bridge, and set it up to relay to a stand-alone version of SLiRP, then how to setup a virtual cisco router to do NAT, and also forward to SLiRP, along with taking network captures to show what is really going on! </p>



<p class="wp-block-paragraph">Software used (in no particular order)</p>



<ul class="wp-block-list">
<li><a href="https://86box.net/" target="_blank" rel="noreferrer noopener">https://86box.net/</a></li>



<li><a href="https://www.7-zip.org/download.htm" target="_blank" rel="noreferrer noopener">https://www.7-zip.org/download.htm</a></li>



<li><a href="https://www.wireshark.org/download.html" target="_blank" rel="noreferrer noopener">https://www.wireshark.org/download.html</a></li>



<li><a href="https://sourceforge.net/projects/dynamips-mingw/" target="_blank" rel="noreferrer noopener">https://sourceforge.net/projects/dynamips-mingw/</a></li>



<li><a href="https://sourceforge.net/projects/hecnetnt/" target="_blank" rel="noreferrer noopener">https://sourceforge.net/projects/hecnetnt/</a></li>



<li><a href="https://github.com/neozeed/dos211" target="_blank" rel="noreferrer noopener">https://github.com/neozeed/dos211</a></li>



<li><a href="https://github.com/neozeed/8086pcc" target="_blank" rel="noreferrer noopener">https://github.com/neozeed/8086pcc</a></li>
</ul>



<p class="wp-block-paragraph">Or for those who prefer the written way&#8230;</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/86box-plus-slirp-eq-no-visability.png" target="_blank" rel="noreferrer noopener"><img fetchpriority="high" decoding="async" width="962" height="302" src="/wp-content/uploads/2024/03/86box-plus-slirp-eq-no-visability.png" alt="" class="wp-image-14179" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-slirp-eq-no-visability.png 962w, https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-slirp-eq-no-visability-300x94.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-slirp-eq-no-visability-768x241.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-slirp-eq-no-visability-500x157.png 500w" sizes="(max-width: 962px) 100vw, 962px" /></a><figcaption class="wp-element-caption">what is going on?</figcaption></figure>



<p class="wp-block-paragraph">In 86box, you have the ability to use the SLiRP library directly from the emulator.  Which is all find and good, but sadly it gives you no visibility when things go wrong.  And with MIT PC/IP things go wrong.  Looking at the data through Wireshark sure would be nice, but how to we get it into there?</p>



<p class="wp-block-paragraph">Well the simplest way is to just break it apart.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/86box-plus-loop-plus-hecnet-eq-visability.png" target="_blank" rel="noreferrer noopener"><img decoding="async" width="1017" height="576" src="/wp-content/uploads/2024/03/86box-plus-loop-plus-hecnet-eq-visability.png" alt="" class="wp-image-14181" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-loop-plus-hecnet-eq-visability.png 1017w, https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-loop-plus-hecnet-eq-visability-300x170.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-loop-plus-hecnet-eq-visability-768x435.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/86box-plus-loop-plus-hecnet-eq-visability-500x283.png 500w" sizes="(max-width: 1017px) 100vw, 1017px" /></a><figcaption class="wp-element-caption">Broken apart into it&#8217;s components</figcaption></figure>



<p class="wp-block-paragraph">Adding in a KM TEST loopback adapter to Windows now gives us a private network we can now attach programs to via the pcap API.  Hecnet is a l2 bridge that can inspect and look for l3 traffic and then forward it via udp to another program.  In this case I had made a version of <a href="https://sourceforge.net/p/dynamips-mingw/code/ci/master/tree/dynamips-master/common/slirp_rdr.c" target="_blank" rel="noreferrer noopener">SLiRP that will communicate via UDP</a>, perfect for stuff like this!</p>



<p class="wp-block-paragraph">One thing to keep in mind is that the &#8216;GUIDS&#8217; of the network interfaces are unique to each system, the ethlist program will show you which is which.  It&#8217;s also why renaming interfaces only helps you when dealing with old libpcap stuff!</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/network-interface-names-for-mit-pcip.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="787" height="194" src="/wp-content/uploads/2024/03/network-interface-names-for-mit-pcip.png" alt="" class="wp-image-14186" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/network-interface-names-for-mit-pcip.png 787w, https://virtuallyfun.com/wp-content/uploads/2024/03/network-interface-names-for-mit-pcip-300x74.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/network-interface-names-for-mit-pcip-768x189.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/network-interface-names-for-mit-pcip-500x123.png 500w" sizes="auto, (max-width: 787px) 100vw, 787px" /></a><figcaption class="wp-element-caption">Rename stuff so it makes sense!  Otherwise, everything is Ethernet</figcaption></figure>



<p class="wp-block-paragraph">Becomes:</p>



<pre class="wp-block-code"><code>C:\hecnet>ethlist.exe
Network devices:
  Number       NAME                                     (Description)
  0  \Device\NPF_{E7EB72FA-7850-4864-B721-2A3B38737214} (KM-TEST)
  1  \Device\NPF_{649448CA-969D-486E-AAC8-99F1993C701A} (Ethernet0)
Press Enter to continue...

C:\hecnet></code></pre>



<p class="wp-block-paragraph">With this information in hand, creating the bridge configuration is quite simple:</p>



<pre class="wp-block-code"><code>&#91;bridge]
Loop \Device\NPF_{E7EB72FA-7850-4864-B721-2A3B38737214}
update 127.0.0.1:5001

&#91;tcpip]
Loop
update</code></pre>



<p class="wp-block-paragraph">The bridge is for an uncompressed normal bridge connection between the KM TEST loopback interface and a UDP connection listening on port 5001 on localhost.  Of note it&#8217;ll be forwarding TCP/IP related packets. Since we want the bridge to listen on UDP port 5000 we simply run it like this:</p>



<pre class="wp-block-code"><code>hecnet.exe 5000</code></pre>



<p class="wp-block-paragraph">Running the SLiRP redirector is just a simple matter of telling it which port to listen on, and where to forward traffic.  In this case we&#8217;ll listen on port 5001 and forward traffic to 5000 on the localhost</p>



<pre class="wp-block-code"><code>slirp_rdr.exe 5001 127.0.0.1 5000</code></pre>



<p class="wp-block-paragraph">Thankfully, it&#8217;s that simple! </p>



<p class="wp-block-paragraph">Running a ping fails (yet again) but this time we can see that they are doing ARP but for some reason PC/IP does not acknowledge the SLiRP library.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="858" height="187" src="/wp-content/uploads/2024/03/mit-pcip-no-working-arp.png" alt="" class="wp-image-14182" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-no-working-arp.png 858w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-no-working-arp-300x65.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-no-working-arp-768x167.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-no-working-arp-500x109.png 500w" sizes="auto, (max-width: 858px) 100vw, 858px" /></figure>



<p class="wp-block-paragraph">Just to verify, the HecnetNT bridge does see the source and destination address, and the SLiRP does indicate traffic in and out as expected.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="689" height="549" src="/wp-content/uploads/2024/03/mit-pcip-no-working-arp-stats-jpg.webp" alt="" class="wp-image-14183" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-no-working-arp-stats-jpg.webp 689w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-no-working-arp-stats-300x239.webp 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-no-working-arp-stats-377x300.webp 377w" sizes="auto, (max-width: 689px) 100vw, 689px" /></figure>



<p class="wp-block-paragraph">Clearly the fault is on the PC/IP side, and most likely because it&#8217;s so old.</p>



<p class="wp-block-paragraph">I then decided to build another network, this time using Dynamips to add in a virtual router.</p>



<figure class="wp-block-image size-large is-resized"><a href="/wp-content/uploads/2024/03/mit-pcip-dynamips-network-diagram2-jpg.webp"><img loading="lazy" decoding="async" width="1024" height="527" src="/wp-content/uploads/2024/03/mit-pcip-dynamips-network-diagram2-1024x527.webp" alt="" class="wp-image-14185" style="width:615px;height:auto" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-dynamips-network-diagram2-1024x527.webp 1024w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-dynamips-network-diagram2-300x154.webp 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-dynamips-network-diagram2-768x395.webp 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-dynamips-network-diagram2-500x257.webp 500w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-dynamips-network-diagram2-jpg.webp 1058w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Adding in a router</figcaption></figure>



<p class="wp-block-paragraph">This complicates things as I&#8217;m not sure how to control the internal routing of the SLiRP library so the router has to NAT the PC/IP traffic to SLiRP, which in turn &#8216;NATs&#8217; it to the internet.  But rest assured double NAT (or even more) is quite common these days.</p>



<p class="wp-block-paragraph">Configuring the router is somewhat straight forward, we are going to use pcap to listen on the KM TEST loopack, replacing the HecnetNT bridge.  But it&#8217;s going to talk to the SLiRP redirector in the same manner:</p>



<pre class="wp-block-code"><code>set loopback=\Device\NPF_{E7EB72FA-7850-4864-B721-2A3B38737214}
set IOS=..\c7200-is-mz.19991126.bin
set NPE=npe-100
set RAM=64 -X

@attrib *.* -r
..\dynamips.exe -P 7200 %IOS%  ^
-m %RAM% ^
-t %NPE%  ^
-p 0:C7200-IO-FE ^
-p 1:PA-4E  ^
-s1:0:gen_eth:%loopback% ^
-s1:1:udp:5000:127.0.0.1:5001</code></pre>



<p class="wp-block-paragraph">This creates a basic 7200 router with a 4 port ethernet card, with one port connected to the KM TEST loopback, and the other connected to the SLiRP library.</p>



<p class="wp-block-paragraph">Configuration of the router is not very complicated either:</p>



<pre class="wp-block-code"><code>!
no ip domain-lookup
!
interface Ethernet1/0
 ip address 192.168.1.1 255.255.255.0
 no ip directed-broadcast
 ip nat inside
!
interface Ethernet1/1
 ip address 10.0.2.15 255.255.255.0
 no ip directed-broadcast
 ip nat outside
!
ip default-gateway 10.0.2.2
ip nat inside source list 1 interface Ethernet1/1 overload
ip classless
ip route 0.0.0.0 0.0.0.0 10.0.2.2
no ip http server
!
access-list 1 permit 192.168.1.0 0.0.0.255
!

</code></pre>



<p class="wp-block-paragraph">This defines our default route for both the routing table, and the management engine to the SLiRP library, defines the NAT inside/outside interfaces along with specifying the &#8216;overload&#8217; address will be the 10.0.2.15 NAT&#8217;ing the PC/IP traffic behind the usual SLiRP user address.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="729" height="448" src="/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router.png" alt="" class="wp-image-14188" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router.png 729w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-300x184.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-488x300.png 488w" sizes="auto, (max-width: 729px) 100vw, 729px" /></a><figcaption class="wp-element-caption">Pinging the SLiRP gateway</figcaption></figure>



<p class="wp-block-paragraph">This allows us to ping SLiRP, and get the expected response.</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-capture.png"><img loading="lazy" decoding="async" width="1025" height="729" src="/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-capture.png" alt="" class="wp-image-14189" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-capture.png 1025w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-capture-300x213.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-capture-768x546.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-pinging-slirp-through-cisco-router-capture-422x300.png 422w" sizes="auto, (max-width: 1025px) 100vw, 1025px" /></a><figcaption class="wp-element-caption">Working ARP/ICMP with cisco router</figcaption></figure>



<p class="wp-block-paragraph">Checking the capture, we can see that yes ARP is working as expected, and the ping works without any issues.</p>



<p class="wp-block-paragraph">On the router we can see the NAT translation.</p>



<pre class="wp-block-code"><code>Router#show ip nat translations
Pro Inside global      Inside local       Outside local      Outside global
tcp 10.0.2.15:4376     192.168.1.5:4376   71.95.196.34:23    71.95.196.34:23
Router#</code></pre>



<p class="wp-block-paragraph">And we can also check the SLiRP redirector for information on the current session.</p>



<pre class="wp-block-code"><code>SLiRP redirector started!
Press 's' for SLiRP stats
Press 'e' to exit.

Sent:           Recv:
stats!          4859

Proto&#91;state]     Sock     Local Address, Port  Remote Address, Port RecvQ SendQ
tcp&#91;ESTABLISHED]  632         10.0.2.15  4376    71.95.196.34    23     0   600
tcp&#91;REDIRECT]     616         10.0.2.15    23        10.0.2.2 42323     0     0

</code></pre>



<p class="wp-block-paragraph">Plus, we also have the Wireshark capture going showing the start of the TCP conversation</p>



<figure class="wp-block-image size-full"><a href="/wp-content/uploads/2024/03/mit-pcip-telnet-slirp-through-cisco-router-capture.png" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1025" height="731" src="/wp-content/uploads/2024/03/mit-pcip-telnet-slirp-through-cisco-router-capture.png" alt="" class="wp-image-14190" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-telnet-slirp-through-cisco-router-capture.png 1025w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-telnet-slirp-through-cisco-router-capture-300x214.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-telnet-slirp-through-cisco-router-capture-768x548.png 768w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-telnet-slirp-through-cisco-router-capture-421x300.png 421w" sizes="auto, (max-width: 1025px) 100vw, 1025px" /></a><figcaption class="wp-element-caption">TCP connected!</figcaption></figure>



<figure class="wp-block-image size-full"><a href="https://www.synchro.net/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="764" height="478" src="/wp-content/uploads/2024/03/mit-pcip-connected-to-vert.png" alt="" class="wp-image-14192" srcset="https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-connected-to-vert.png 764w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-connected-to-vert-300x188.png 300w, https://virtuallyfun.com/wp-content/uploads/2024/03/mit-pcip-connected-to-vert-479x300.png 479w" sizes="auto, (max-width: 764px) 100vw, 764px" /></a><figcaption class="wp-element-caption">Connected to VERT</figcaption></figure>



<p class="wp-block-paragraph">So now we&#8217;ve connected to the internet and by breaking the process appart we can now inspect what is going on, and made modifications like adding a cisco router.</p>



<p class="wp-block-paragraph">I figured that this may be something that other people may be interested in, as you can build far more complex virtual networks this way!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2024/03/25/using-mit-pc-ip-with-slirp-a-virtual-cisco-router/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Re-visiting the SUN-2 emulator: Adding SLiRP!</title>
		<link>https://virtuallyfun.com/2020/08/21/re-visiting-the-sun-2-emulator-adding-slirp/</link>
					<comments>https://virtuallyfun.com/2020/08/21/re-visiting-the-sun-2-emulator-adding-slirp/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 21 Aug 2020 16:55:06 +0000</pubDate>
				<category><![CDATA[4 BSD]]></category>
		<category><![CDATA[4.2 BSD]]></category>
		<category><![CDATA[68000]]></category>
		<category><![CDATA[m68k]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[SUN]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/wordpress/?p=10445</guid>

					<description><![CDATA[While I&#8217;ve covered Brad Parker (lisper)&#8217;s &#8216;emulator-sun-2&#8216; before, booting into SunOS isn&#8217;t anything that new. However, with the latest updates, from github, adding in a prior botched attempt, and some messing around, and finally, I got it to ping at &#8230; <a href="https://virtuallyfun.com/2020/08/21/re-visiting-the-sun-2-emulator-adding-slirp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">While I&#8217;ve covered <a href="http://www.heeltoe.com/">Brad Parker</a> (<a href="https://github.com/lisper">lisper</a>)&#8217;s &#8216;<a href="https://github.com/lisper/emulator-sun-2">emulator-sun-2</a>&#8216; <a href="/wordpress/2020/02/16/emulator-sun-2/">before</a>, booting into SunOS isn&#8217;t anything that new.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="936" src="https://virtuallyfun.com/wp-content/uploads/2020/08/SUN2-emulator-booting-SunOS-2-1024x936.png" alt="" class="wp-image-10446" srcset="https://virtuallyfun.com/wp-content/uploads/2020/08/SUN2-emulator-booting-SunOS-2-1024x936.png 1024w, https://virtuallyfun.com/wp-content/uploads/2020/08/SUN2-emulator-booting-SunOS-2-300x274.png 300w, https://virtuallyfun.com/wp-content/uploads/2020/08/SUN2-emulator-booting-SunOS-2-768x702.png 768w, https://virtuallyfun.com/wp-content/uploads/2020/08/SUN2-emulator-booting-SunOS-2-328x300.png 328w, https://virtuallyfun.com/wp-content/uploads/2020/08/SUN2-emulator-booting-SunOS-2.png 1026w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">However, with the latest updates, from <a href="https://github.com/lisper/emulator-sun-2">github</a>, adding in a prior botched attempt, and some messing around, and finally, I got it to ping at first, then it was a matter of where to place the &#8216;slirp tick&#8217;.  I first though putting it on the interface poll was a good spot, but for some reason the machine causes a deadlock/stall on boot before the PROM can even initialize.  I&#8217;m not sure why.  Searching further I found a good timer portion and injected the code.  And sure enough I was greeted with the login banner:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="979" height="512" src="https://virtuallyfun.com/wp-content/uploads/2020/08/Telnet-into-SunOS-2.png" alt="" class="wp-image-10447" srcset="https://virtuallyfun.com/wp-content/uploads/2020/08/Telnet-into-SunOS-2.png 979w, https://virtuallyfun.com/wp-content/uploads/2020/08/Telnet-into-SunOS-2-300x157.png 300w, https://virtuallyfun.com/wp-content/uploads/2020/08/Telnet-into-SunOS-2-768x402.png 768w, https://virtuallyfun.com/wp-content/uploads/2020/08/Telnet-into-SunOS-2-500x261.png 500w" sizes="auto, (max-width: 979px) 100vw, 979px" /></figure>



<p class="wp-block-paragraph">I&#8217;ve been able to paste in about 100kb of a uuencoded tar file, and it didn&#8217;t lock the VM, and I was able to uudecode it, and actually build the source (<a href="/wordpress/2014/12/15/tracking-down-the-infotaskforce-from-1987/">Infotaskforce &#8217;87 if anyone cares</a>).  So I&#8217;m at the point I think it&#8217;s stable enough to shove into the world, although I guess until I revisit it again.</p>



<p class="wp-block-paragraph">You can download it on sourceforge: <a href="https://sourceforge.net/projects/bsd42/files/4BSD%20under%20Windows/v0.4/sun2.zip/download">sun2.zip</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2020/08/21/re-visiting-the-sun-2-emulator-adding-slirp/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Patching GCC 4.1.2 to build under GCC 8</title>
		<link>https://virtuallyfun.com/2020/08/17/patching-gcc-4-1-2-to-build-under-gcc-8/</link>
					<comments>https://virtuallyfun.com/2020/08/17/patching-gcc-4-1-2-to-build-under-gcc-8/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Mon, 17 Aug 2020 08:35:36 +0000</pubDate>
				<category><![CDATA[64bit computing]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[User Mode Linux]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/wordpress/?p=10430</guid>

					<description><![CDATA[What started as a spriling out of control build of SLiRP for User Model Linux (UML) I had so many issues with GCC 8, I figured I&#8217;d try v4 where I recall it building easily. Well that was. Fun. Anywas &#8230; <a href="https://virtuallyfun.com/2020/08/17/patching-gcc-4-1-2-to-build-under-gcc-8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">What started as a spriling out of control build of SLiRP for User Model Linux (UML) I had so many issues with GCC 8, I figured I&#8217;d try v4 where I recall it building easily.  Well that was. Fun.</p>



<p class="wp-block-paragraph">Anywas I&#8217;m using Linux (Debian 10.5), and the build tools currently has me running GCC 8.3.0.  Anyways a straight build introduces this fun:</p>



<pre class="wp-block-code"><code>../.././gcc/toplev.c: At top level:
../.././gcc/toplev.c:524:1: error: redefinition of 'floor_log2'
 floor_log2 (unsigned HOST_WIDE_INT x)
 ^~~~~~~~~~
In file included from ../.././gcc/toplev.c:59:
../.././gcc/toplev.h:175:1: note: previous definition of 'floor_log2' was here
 floor_log2 (unsigned HOST_WIDE_INT x)
 ^~~~~~~~~~
../.././gcc/toplev.c:559:1: error: redefinition of 'exact_log2'
 exact_log2 (unsigned HOST_WIDE_INT x)
 ^~~~~~~~~~
In file included from ../.././gcc/toplev.c:59:
../.././gcc/toplev.h:181:1: note: previous definition of 'exact_log2' was here
 exact_log2 (unsigned HOST_WIDE_INT x)
 ^~~~~~~~~~
make&#91;2]: *** &#91;Makefile:2064: toplev.o] Error 1
make&#91;2]: Leaving directory '/home/jsteve/src/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc'
make&#91;1]: *** &#91;Makefile:3905: all-gcc] Error 2
make&#91;1]: Leaving directory '/home/jsteve/src/gcc-4.1.2'</code></pre>



<p class="wp-block-paragraph">Ugh isn&#8217;t this fun.  Well it turns out it&#8217;s largely from the confusion from how GCC now handles inline functions.</p>



<p class="wp-block-paragraph">I&#8217;ve uploaded <a href="https://virtuallyfun.com/wp-content/uploads/2020/08/gcc-4.1.2-buildwith-gcc8.3.0.diff_.gz">the patch here</a>.  It&#8217;s not great, I know but I got a working C compiler out of it, however I had to manually place xgcc/cc1/cpp from gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc</p>



<p class="wp-block-paragraph">Naturally <a href="https://www.urbandictionary.com/define.php?term=ymmv">YMMV</a> as always.</p>



<p class="wp-block-paragraph">I did see further hints on this &#8216;<a href="https://gist.github.com/lucasw/7997efdad0b0c467ffac75e35b716c33">gist</a>&#8216; that also boils down to using GCC in 1989 mode for inlines:</p>



<pre class="wp-block-code"><code>gcc -fgnu89-inline</code></pre>



<p class="wp-block-paragraph">And also this <a href="https://unix.stackexchange.com/questions/219708/arch-compiling-toplev-o-fails-in-gcc-install">&#8216;stack exchange</a>&#8216; that mentions that toplev also has issues with the same inline issues.  Naturally if you just define inline to nothing you&#8217;ll end up with two floor_log2 and exact_log2&#8217;s from libiberty.  And both are different. Fun times ahead!</p>



<p class="wp-block-paragraph">As for slirp, well I took the version from the <a href="https://packages.debian.org/source/sid/slirp">Debian source project</a>, and manually applied all <a href="http://deb.debian.org/debian/pool/main/s/slirp/slirp_1.0.17-10.debian.tar.xz">the patches</a> and I ended up not only having to manually create some missing headers, but after getting it to build it&#8217;d just crash immediately.  Bummer.</p>



<p class="wp-block-paragraph">I rebuilt it as a 32bit exe, and wow it ran just fine.  Go figure.  For anyone crazy enough to want to build it on it&#8217;s own, this patch take <a href="https://ftp.fau.de/macports/distfiles/slirp/slirp-1.0.16.tar.gz">slirp-1.0.16</a> to a &#8217;17&#8217; with all the <a href="https://virtuallyfun.com/wp-content/uploads/2020/08/slirp-1.0.17-debian-patch17.diff_.gz">current Debian patches</a>, and <a href="https://virtuallyfun.com/wp-content/uploads/2020/08/slirp-1.0.17-jason.diff_.gz">my sad patch</a>, was what I did to get it to compile with GCC 4.  Note you will want to save aside the &#8216;.p files&#8217; which are the headers, as the configure will remove them and either save them as empty files, or files that don&#8217;t work. &#8230; Well at least they didn&#8217;t work for me!</p>



<p class="wp-block-paragraph">The whole thing started as a &#8216;oh wow Linux is now in 5.1.0 release&#8217; and I figured the easiest way to check it out was to use UML.  I found <a href="https://christine.website/blog/howto-usermode-linux-2019-07-07">this page</a> with a quick &#8216;how to build and roll&#8217; your own UML&#8217;s, although the SLiRP config is a bit off in the host, as it should be 10.0.2.15 for the UML kernel.</p>



<p class="wp-block-paragraph">The new killer feature is UML can mount a directory as a filesystem so you don&#8217;t have to mess around like crazy to make disk images.  It makes the experience more docker like, which I enjoy.</p>



<pre class="wp-block-code"><code>./linux root=/dev/root rootfstype=hostfs rootflags=/home/jsteve/linux/linux-5.1.17/uml-demo2 rw mem=64M init=/bin/sh</code></pre>



<p class="wp-block-paragraph">So no I end up running this in the VM to kick off the required mounts and networking.</p>



<pre class="wp-block-code"><code>mount -t proc proc proc/
mount -t sysfs sys sys/
ifconfig eth0 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
route add default gw 10.0.2.2
ping -c 2 10.0.2.2
</code></pre>



<p class="wp-block-paragraph">Oh one thing worth pointing out is that 5.1.16 breaks 32bit compiles, you have to build 5.1.17 to get a 32bit kernel.</p>



<p class="wp-block-paragraph">I should touch more on building UML but I&#8217;ve already sat on this for a week, and I&#8217;m too busy moving (yet again) to a smaller island.  Hopefully a more peaceful one.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2020/08/17/patching-gcc-4-1-2-to-build-under-gcc-8/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Added UDP to Qemu0.90</title>
		<link>https://virtuallyfun.com/2019/03/18/added-udp-to-qemu0-90/</link>
					<comments>https://virtuallyfun.com/2019/03/18/added-udp-to-qemu0-90/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Mon, 18 Mar 2019 12:28:31 +0000</pubDate>
				<category><![CDATA[Dynamips]]></category>
		<category><![CDATA[QEMU]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/wordpress/?p=9286</guid>

					<description><![CDATA[Yes, I know it&#8217;s kinda pointless as it&#8217;s horribly out of date, but I&#8217;m still having fun. Anyways now it&#8217;ll integrate with dynamips! So yeah, in this example, instead of the usual &#8220;-net user&#8221; and the built in SLiRP stack, &#8230; <a href="https://virtuallyfun.com/2019/03/18/added-udp-to-qemu0-90/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Yes, I know it&#8217;s kinda pointless as it&#8217;s horribly out of date, but I&#8217;m still having fun.  Anyways now it&#8217;ll integrate with <a href="https://sourceforge.net/projects/dynamips-mingw/">dynamips</a>!</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="978" height="696" src="https://virtuallyfun.com/wp-content/uploads/2019/03/Qemu090-with-UDP-packet-networking.png" alt="" class="wp-image-9287" srcset="https://virtuallyfun.com/wp-content/uploads/2019/03/Qemu090-with-UDP-packet-networking.png 978w, https://virtuallyfun.com/wp-content/uploads/2019/03/Qemu090-with-UDP-packet-networking-300x213.png 300w, https://virtuallyfun.com/wp-content/uploads/2019/03/Qemu090-with-UDP-packet-networking-768x547.png 768w" sizes="auto, (max-width: 978px) 100vw, 978px" /></figure>



<p class="wp-block-paragraph">So yeah, in this example, instead of the usual &#8220;-net user&#8221; and the built in SLiRP stack, this uses UDP to talk to a stand-alone SLiRP stack.  This will let you plug your Qemu into virtual Ethernet switches/hubs and interfaces of virtual routers.  Even mixing and matching connections to different emulators that use UDP to exchange packets.</p>



<p class="wp-block-paragraph">In this case I have a VMDK loaded with a NE2K-PCI driver, and QuakeWorld for MS-DOS.  I also made the MPU401 external although it&#8217;s hanging on a secondary flag&#8230;</p>



<p class="wp-block-paragraph">qemu.exe -L pc-bios -m 64 -soundhw sb16,adlib -mpu401 xx -net nic,model=ne2k_pci -net socket,udp=127.0.0.1:4000,remote=127.0.0.1:4001 -hda qworld.vmdk</p>



<p class="wp-block-paragraph">This has the Qemu instance listen on UDP port 4000, and connect to the same physical host on port 4001.</p>



<p class="wp-block-paragraph">The recipical for the SLiRP stack from my bashed Dynamips is:</p>



<p class="wp-block-paragraph">slirp_rdr.exe 4001 127.0.0.1 4000</p>



<p class="wp-block-paragraph">Which in this case listens on port 4001, and connects back on port 4000.</p>



<p class="wp-block-paragraph">Hopefully it makes some sense to someone.</p>



<p class="wp-block-paragraph">Download it, if you want!</p>



<a href="https://sourceforge.net/projects/qemu090b/files/latest/download"><img decoding="async" alt="Download Qemu090b" src="https://a.fsdn.com/con/app/sf-download-button" width=276 height=48 srcset="https://a.fsdn.com/con/app/sf-download-button?button_size=2x 2x"></a>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2019/03/18/added-udp-to-qemu0-90/feed/</wfw:commentRss>
			<slash:comments>16</slash:comments>
		
		
			</item>
		<item>
		<title>User Mode Linux revisited (UML) aka SLiRP networking</title>
		<link>https://virtuallyfun.com/2016/10/02/user-mode-linux-revisited-uml-aka-slirp-networking/</link>
					<comments>https://virtuallyfun.com/2016/10/02/user-mode-linux-revisited-uml-aka-slirp-networking/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 02 Oct 2016 13:22:35 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[User Mode Linux]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=6446</guid>

					<description><![CDATA[So my uh &#8216;friend&#8217; that got into trouble when he found out that his &#8216;dedicated&#8217; machine turned out to be a VM which he couldn&#8217;t launch nested KVM VM&#8217;s, and instead found that User Mode Linux (UML), would allow them &#8230; <a href="https://virtuallyfun.com/2016/10/02/user-mode-linux-revisited-uml-aka-slirp-networking/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>So my uh &#8216;friend&#8217; that got into trouble when he found out that his &#8216;dedicated&#8217; machine turned out to be a VM which he couldn&#8217;t launch nested KVM VM&#8217;s, and instead found that <a href="https://virtuallyfun.com/2016/04/02/user-mode-linux/">User Mode Linux (UML)</a>, would allow them to run their touchy ancient Linux application in a psudo VM/Container.  Well they finally bit the bullet and decided to move to something better.</p>
<p>And by better, it was cheaper.  And why was it cheaper?  Because it is even a more restricted VM.</p>
<p>Great.</p>
<p>So naturally the panic call was made, because TUN/TAP networking was not permitted in this new VM.  So what to do.</p>
<p>Well, keeping in mind how Qemu gets around this problem, it binds in a copy of SLiRP.  And it turns out that UML can actually call SLiRP directly!  So cool we have an &#8216;out&#8217;.  First things first, we need SLiRP on the host machine.  I&#8217;m old, so that means I build it from source.That means I&#8217;m downloading <a href="https://sourceforge.net/projects/slirp/files/slirp/1.0.16/slirp-1.0.16.tar.gz/download">slirp-1.0.16.tar.gz</a>, along with the <a href="https://sourceforge.net/projects/slirp/files/slirp/1.0.17%20patch/slirp_1_0_17_patch.tar.gz/download">1.0.17 patch</a>.  I&#8217;m not sure if I need to go into how to extract source, patch, running configure and compiling.</p>
<p>One thing of note is that you really really really want to set the &#8220;FULL_BOLT&#8221; option either in the Makefile, or in config.h</p>
<p>With SLiRP built, I just copy it into /usr/local/bin .. I&#8217;m sure there is packages and stuff out there, but heh I&#8217;m old.</p>
<p>OK next up I make a small script to call SLiRP, in this case, I&#8217;m going to redirect port 80 directly into the VM.  And for a test port 2323 which then goes into port 23 (why not ssh? .. sigh don&#8217;t go there).</p>
<p>So my script looks like this:</p>
<p style="padding-left: 30px;">#!/bin/sh<br />
/usr/local/bin/slirp &#8220;redir 80 80&#8221; &#8220;redir 23 2323&#8221;</p>
<p>Pretty simple right?  I&#8217;m using a script as there will be more than one VM, so relying on .slirprc isn&#8217;t a solution for me.</p>
<p style="padding-left: 30px;">./linux-2.6.24-rc7 ubd0=junk.ubda eth0=slirp,,/virtual/sl.sh</p>
<p>And away we go!</p>
<p>Inside the VM we can configure it with the usual SLiRP config:</p>
<p style="padding-left: 30px;">ifconfig eth0 10.0.2.15 255.255.255.0<br />
route add default gw 10.0.2.2</p>
<p>And now we can access the internal http server!</p>
<p>Add in some magic to /etc/resolv.conf such as:</p>
<p style="padding-left: 30px;">nameserver 10.0.2.3</p>
<p>and it&#8217;ll automatically use whatever the host is configured to do.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2016/10/02/user-mode-linux-revisited-uml-aka-slirp-networking/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>One million packets served!</title>
		<link>https://virtuallyfun.com/2015/09/18/one-million-packets-served/</link>
					<comments>https://virtuallyfun.com/2015/09/18/one-million-packets-served/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 18 Sep 2015 01:27:37 +0000</pubDate>
				<category><![CDATA[Dynamips]]></category>
		<category><![CDATA[mingw]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=5496</guid>

					<description><![CDATA[So over in my work on porting Dynamips to MinGW, I&#8217;ve created a version of SLiRP that sends and receives data over UDP. Â In retrospect, something I should have done a long time ago, as it makes troubleshooting it easier &#8230; <a href="https://virtuallyfun.com/2015/09/18/one-million-packets-served/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_5497" style="width: 813px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2015/09/one-million-packets-served.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5497" class="size-full wp-image-5497" src="https://virtuallyfun.com/wp-content/uploads/2015/09/one-million-packets-served.png" alt="one million ICMP packets!" width="803" height="470" /></a><p id="caption-attachment-5497" class="wp-caption-text">Success rate is 100 percent (1000000/1000000)!</p></div></p>
<p>So over in my work on porting <a href="https://sourceforge.net/projects/dynamips-mingw/">Dynamips to MinGW</a>, I&#8217;ve created a version of SLiRP that sends and receives data over UDP. Â In retrospect, something I should have done a long time ago, as it makes troubleshooting it easier as now if it were to crash it&#8217;s a stand alone program, so it won&#8217;t crash the emulator.</p>
<p>The good news is that I&#8217;ve been able to copy files into the virtual router using HTTP. Â I&#8217;ve even been able to access my OS/2 machine over FTP and load a file!</p>
<p style="padding-left: 30px;">R1#copy ftp://10.12.0.14/README disk0:<br />
Destination filename [README]?<br />
Accessing ftp://10.12.0.14/README&#8230;<br />
Loading README !<br />
[OK &#8211; 76743/4096 bytes]</p>
<p style="padding-left: 30px;">76743 bytes copied in 8.740 secs (8781 bytes/sec)</p>
<p style="padding-left: 30px;">R1#dir disk0:README<br />
Directory of disk0:/README</p>
<p style="padding-left: 30px;">12 -rw- 76743 Sep 18 2015 09:01:08 +00:00 README</p>
<p style="padding-left: 30px;">66875392 bytes total (41652224 bytes free)</p>
<p>Which is very cool!</p>
<p>Part of the &#8216;trick&#8217; is that you should set your time out to be as long as possible to send a million packets. Â I just set the maximum values.</p>
<p style="padding-left: 30px;">line con 0</p>
<p style="padding-left: 60px;">exec-timeout 35791 23<br />
stopbits 1</p>
<p style="padding-left: 30px;">line aux 0</p>
<p style="padding-left: 60px;">stopbits 1</p>
<p style="padding-left: 30px;">line vty 0 4</p>
<p style="padding-left: 60px;">exec-timeout 35791 0<br />
timeout login response 300<br />
password cisco<br />
login</p>
<p style="padding-left: 30px;">!<br />
end</p>
<p>In addition, a 7200 with idle performs MUCH better than a 1700 without idle. Â There is something up with ptask, and only dispatching packets every so often. Â I&#8217;m guessing it&#8217;s done that way for a reason.</p>
<p>Also one other cool IOS trick I learned today is that you can redirect to a file resource! Say you want that &#8216;show tech-support&#8217; as a file on the disk? No problem!</p>
<p style="padding-left: 30px;">show tech-support | redirect disk0:tech.txt</p>
<p>And of course the newer versions of IOS have a &#8216;do&#8217; command that you can run from config mode to execute user commands.</p>
<p style="padding-left: 30px;">R1(config)#do who<br />
Line User Host(s) Idle Location<br />
* 0 con 0 idle 00:00:00<br />
2 vty 0 idle 15:24:11 10.0.2.2<br />
3 vty 1 idle 14:59:56 10.0.2.2<br />
4 vty 2 idle 13:43:44 10.0.2.2<br />
5 vty 3 idle 11:23:44 10.0.2.2</p>
<p>Â Take that Junos!</p>
<p>For anyone interested, <a href="https://sourceforge.net/projects/dynamips-mingw/files/latest/download?source=navbar">the binary is included in the latest binary snapshot</a>, and using it is pretty simple:</p>
<p style="padding-left: 30px;">slirp_rdr.exe 20001 127.0.0.1 20000</p>
<p>This will listen on port 20001, and send traffic to 127.0.0.1 on port 20000. Â Easy right?</p>
<p>Manually interfacing from the hypervisor can be the &#8216;fun&#8217; part. Â I haven&#8217;t tested with any of the tools, as I don&#8217;t know if they will let you leave something &#8216;listening&#8217; that isn&#8217;t connected. For my tests I end up building something with their UI, then loading up my hypervisor that logs, and seeing what it is actually doing so I can inject stuff like this:</p>
<p style="padding-left: 30px;">nio create_udp nio_udp99 20000 127.0.0.1 20001<br />
ethsw add_nio S1 nio_udp99<br />
ethsw set_access_port S1 nio_udp99 1</p>
<p>This creates a udp nio, and attaches it onto the virtual etherswitch S1, and puts it on VLAN 1. Â As you can see it listens on UDP port 20000, which is where slirp_rdr is setup to send it&#8217;s data to, and it&#8217;ll send to 20001 where slirp_rdr is listening.</p>
<p>I&#8217;ve hard coded port 42323 to telnet into 10.0.2.15. Â As always SLiRP is hard coded to have the following ip address schema:</p>
<p style="padding-left: 30px;">Gateway 10.0.2.2<br />
DNS 10.0.2.3<br />
Netmask 255.255.255.0</p>
<p>Be sure to set your router to 10.0.2.15/24 for this to work, and add 10.0.2.2 as your default gateway.</p>
<p>The ONLY address that will respond to ping is 10.0.2.2 . Â This is just the way SLiRP is. Â HTTP and TCP based stuff works best, things like PPTP will not. Â It&#8217;s really hit and miss, but the cool thing is that it doesn&#8217;t require any device drivers, it&#8217;s all user mode code!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2015/09/18/one-million-packets-served/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>More progress on PCem and networking</title>
		<link>https://virtuallyfun.com/2015/08/28/more-progress-on-pcem-and-networking/</link>
					<comments>https://virtuallyfun.com/2015/08/28/more-progress-on-pcem-and-networking/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 28 Aug 2015 13:30:00 +0000</pubDate>
				<category><![CDATA[pcem]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=5355</guid>

					<description><![CDATA[PCem is different from other emulators in that when it starts up, reboots it&#8217;ll tear itself apart, and re-kick all the components. Â Normally other emulators do this once, and as a result I never noticed that slirp_exit doesn&#8217;t actually purge &#8230; <a href="https://virtuallyfun.com/2015/08/28/more-progress-on-pcem-and-networking/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_5356" style="width: 1418px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2015/08/PCem-328-slirp-with-redirect.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5356" class="size-full wp-image-5356" src="https://virtuallyfun.com/wp-content/uploads/2015/08/PCem-328-slirp-with-redirect.png" alt="SLiRP tcp redirects now working" width="1408" height="866" /></a><p id="caption-attachment-5356" class="wp-caption-text">SLiRP tcp redirects now working</p></div></p>
<p>PCem is different from other emulators in that when it starts up, reboots it&#8217;ll tear itself apart, and re-kick all the components. Â Normally other emulators do this once, and as a result I never noticed that slirp_exit doesn&#8217;t actually purge the socket state. Â And calling the socket teardown call causes a mbuf explosion in the code. Â Sadly GDB is pretty useless trying to debug it, since it&#8217;s claiming all the structure members don&#8217;t exist. Â Very strange.</p>
<p>Luckily I could duplicate the debug feature to go though current socket redirects, and close the sockets on the Windows side with a simple closesocket.</p>
<p>In this version I&#8217;ve setup the following TCP port redirects:</p>
<p>ExternalPORTÂ  Â  Internal Port<br />
42322Â  Â  Â  Â  Â  Â  Â  Â  Â 22<br />
42323Â  Â  Â  Â  Â  Â  Â  Â  Â 23<br />
42380Â  Â  Â  Â  Â  Â  Â  Â  Â 80<br />
42443Â  Â  Â  Â  Â  Â  Â  Â  Â 443</p>
<p>I still haven&#8217;t messed with the rc file, so there is no GUI config, instead you have to do it in the text files. Â I have some notes on the whole thing on <a href="http://pcem-emulator.co.uk/phpBB3/viewtopic.php?f=3&amp;t=287&amp;start=90">the pcem forum here</a>.</p>
<p>Download the <a href="http://vpsland.superglobalmegacorp.com/install/pcem/PCem-0657320820ab-pcap-slirp.7z">executables and source here</a>:</p>
<p><a href="http://vpsland.superglobalmegacorp.com/install/pcem/PCem-0657320820ab-pcap-slirp.7z">http://vpsland.superglobalmegacorp.com/install/pcem/PCem-0657320820ab-pcap-slirp.7z</a></p>
<p>And for those interested, <a href="http://vpsland.superglobalmegacorp.com/install/pcem/slirpdiff-328.diff.gz">the diff against mainline 328 is here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2015/08/28/more-progress-on-pcem-and-networking/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Adding SLiRP to PCem</title>
		<link>https://virtuallyfun.com/2015/08/23/adding-slirp-to-pcem/</link>
					<comments>https://virtuallyfun.com/2015/08/23/adding-slirp-to-pcem/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 23 Aug 2015 12:41:06 +0000</pubDate>
				<category><![CDATA[pcem]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=5327</guid>

					<description><![CDATA[So PCem is an incredible emulator for the IBM PC platform. Â One thing that has been missing, and really missed has been networking. Â So a while ago,Â SA1988 came up with a patch that incorporated the BOCHS ne2k.cc into PCem. So &#8230; <a href="https://virtuallyfun.com/2015/08/23/adding-slirp-to-pcem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>So <a href="http://pcem-emulator.co.uk/">PCem</a> is an incredible emulator for the IBM PC platform. Â One thing that has been missing, and really missed has been networking. Â So a while ago,Â <a href="http://pcem-emulator.co.uk/phpBB3/viewtopic.php?t=70&amp;p=267">SA1988 came up with a patch</a> that incorporated the <a href="http://bochs.sourceforge.net/cgi-bin/lxr/source/iodev/network/ne2k.cc">BOCHS ne2k.cc</a> into PCem.</p>
<p>So as requested, I took the copy of SLiRP I&#8217;ve used in SIMH, Cockatrice and Previous, and got it working in PCem.</p>
<p><div id="attachment_5328" style="width: 735px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2015/08/Screen-Shot-2015-08-23-at-7.46.56-PM.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5328" class="size-full wp-image-5328" src="https://virtuallyfun.com/wp-content/uploads/2015/08/Screen-Shot-2015-08-23-at-7.46.56-PM.png" alt="Telnet" width="725" height="447" /></a><p id="caption-attachment-5328" class="wp-caption-text">Telnet from MS-DOS</p></div></p>
<p>This has to be one of the easier ports since PCem doesn&#8217;t use threads. Â But yes, it appears to work, although I haven&#8217;t done any major testing.</p>
<p>For those who want to experiment, here is a <a href="http://vpsland.superglobalmegacorp.com/install/pcem/PCem-working-slirp-adc910ece930.7z">binary/source blob of the project</a>. Â Right now we are just past the OMG it compiled phase to OMG it SENT and <strong>RECEIVED</strong> data phase.</p>
<p>If anyone wants to play, the NE2000 is set to 0x300 IRQ 10.</p>
<p>And you need to manually add the following to your pcem.cfg file:</p>
<p style="padding-left: 30px;">netinterface = 1<br />
netcard = 1</p>
<p>And you should be good to go. I think.</p>
<p><div id="attachment_5330" style="width: 656px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2015/08/Screen-Shot-2015-08-24-at-1.20.21-AM.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5330" class="size-full wp-image-5330" src="https://virtuallyfun.com/wp-content/uploads/2015/08/Screen-Shot-2015-08-24-at-1.20.21-AM.png" alt="QuakeWorld" width="646" height="443" /></a><p id="caption-attachment-5330" class="wp-caption-text">QuakeWorld</p></div></p>
<p>And yes, it&#8217;ll run <a href="https://virtuallyfun.com/2011/01/06/quakeworld-client-for-ms-dos/">QuakeWorld</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2015/08/23/adding-slirp-to-pcem/feed/</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>Previous 0.52 (trunk 391) + slirp</title>
		<link>https://virtuallyfun.com/2015/04/12/previous-0-52-trunk-391-slirp/</link>
					<comments>https://virtuallyfun.com/2015/04/12/previous-0-52-trunk-391-slirp/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 12 Apr 2015 03:36:05 +0000</pubDate>
				<category><![CDATA[NeXTSTEP]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Previous]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=5027</guid>

					<description><![CDATA[I got this request to add in some SLiRP to Previous, the NeXT computer emulator.  Sadly work got in the way, and I trashed my windows dev machine.  To make it worse I also trashed my MacBook Air, but with &#8230; <a href="https://virtuallyfun.com/2015/04/12/previous-0-52-trunk-391-slirp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>I got this request to add in some SLiRP to <a href="http://previous.alternative-system.com/">Previous</a>, the <a href="http://en.wikipedia.org/wiki/NeXT_Computer">NeXT computer</a> emulator.  Sadly work got in the way, and I trashed my windows dev machine.  To make it worse I also trashed my MacBook Air, but with a bit of screwing around I got X-code removed, and re-installed.</p>
<p>So here is my wonderful work, some 50 lines of code + the SLiRP from <a href="https://virtuallyfun.com/?p=4584">Cockatrice</a> all hacked up.</p>
<p>ICMP to 10.0.2.2 seems to work fine, UDP seems to not work, so no DNS.  I don&#8217;t know why either.  I can telnet to my <a href="http://bbs.superglobalmegacorp.com/">BBS</a> just fine, which is about all the testing I&#8217;ve done.</p>
<p><div id="attachment_5028" style="width: 942px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2015/04/Screen-Shot-2015-04-12-at-10.37.24-AM.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5028" class="size-full wp-image-5028" src="https://virtuallyfun.com/wp-content/uploads/2015/04/Screen-Shot-2015-04-12-at-10.37.24-AM.png" alt="Previous to the BBS" width="932" height="569" /></a><p id="caption-attachment-5028" class="wp-caption-text">Previous to the BBS</p></div></p>
<p>Inbound TCP seems to be broken too, but I could be initializing slirp_redirect incorrectly too.</p>
<p>In case you want to follow up on this the <a href="http://www.nextcomputers.org/forums/viewtopic.php?p=20575">NeXT computer forums is the place to be</a>.  Networking with NeXTSTEP is involved.</p>
<p>And for anyone who want&#8217;s my files, <a href="http://vpsland.superglobalmegacorp.com/old/install/OS%20X%20x86/Previous/previous-code-391+slirp.7z">the source is here</a>, and <a href="http://vpsland.superglobalmegacorp.com/old/install/OS%20X%20x86/Previous/Previous-0.52+slirp.7z">an OS X 10.10.3 binary is here</a>.  Be sure to install the <a href="https://www.libsdl.org/download-2.0.php">SDL2 framework</a> ahead of time!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2015/04/12/previous-0-52-trunk-391-slirp/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
			</item>
		<item>
		<title>SheepShaver with pcap support</title>
		<link>https://virtuallyfun.com/2014/11/06/sheepshaver-with-pcap-support/</link>
					<comments>https://virtuallyfun.com/2014/11/06/sheepshaver-with-pcap-support/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Thu, 06 Nov 2014 10:35:55 +0000</pubDate>
				<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[pcap]]></category>
		<category><![CDATA[powerpc]]></category>
		<category><![CDATA[SheepShaver]]></category>
		<category><![CDATA[SLiRP]]></category>
		<category><![CDATA[virtual networking]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=4721</guid>

					<description><![CDATA[so I got it to &#8220;work&#8221; on OS X&#8230;.. well 10.6 in VMWare. I have no idea if this means it will work on your setup. If AppleTalk packets get passed early in the boot stage, it will crash. If &#8230; <a href="https://virtuallyfun.com/2014/11/06/sheepshaver-with-pcap-support/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_4722" style="width: 815px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2014/11/pcap-with-sheepshaver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4722" class="size-full wp-image-4722" src="https://virtuallyfun.com/wp-content/uploads/2014/11/pcap-with-sheepshaver.png" alt="It &quot;works&quot;, just incredibly slowly" width="805" height="626" /></a><p id="caption-attachment-4722" class="wp-caption-text">It &#8220;works&#8221;, just incredibly slowly</p></div></p>
<p>so I got it to &#8220;work&#8221; on OS X&#8230;.. well 10.6 in VMWare. I have no idea if this means it will work on your setup.</p>
<ul>
<li class="postbody">If AppleTalk packets get passed early in the boot stage, it will crash.</li>
<li class="postbody">If JIT is enabled, it will crash</li>
<li class="postbody">Performance is horrible, I&#8217;m getting 150k/sec on my LAN, Basilisk II with no JIT blows this thing away.</li>
</ul>
<div class="postbody">Honestly I feel kind of hesitant releasing this, but I know it was desired, and I guess it&#8217;ll help someone somewhere being able to have an easier conversation&#8230; So I&#8217;m going to upload my source tree, including binaries built with GCC 4.0 &amp; 4.2 with either O2 or Os flags. I&#8217;m not sure which is more stable/faster&#8230;So <a class="postlink" href="http://vpsland.superglobalmegacorp.com/install/MacOS//SheepShaver/SheepShaver-hackedpcap-OSX.7z">here is my source tree</a>. Sorry you still have to deal with the changing password thing, but cancel it, and it&#8217;ll tell you the password.Other lessons learned&#8230; SheepShaver&#8217;s segfault model only works when the CPU thread is the main thread. Even though you &#8220;can&#8221; stuff the CPU into a subordinate thread, it doesn&#8217;t play nice once it segfaults, it&#8217;ll just spin waiting for something that clearly isn&#8217;t going to happen.In config.h I added in USEGLOBALvideo as a way for main to call the screen update to end the vast majority of pool leakage. I also added SHEEPSHAVER_CURSOR to enable the hardware cursor. I was having some issues installing OS 8.x when the &#8216;hand&#8217; was drumming the fingers waiting for the OS to install it crashed many times, while disabling the hardware cursor made it play nicer. Maybe it&#8217;s my setup, I&#8217;m not sure.</p>
<p>Also in this version I don&#8217;t read .sheepshaver_prefs but rather sheepshaver_prefs in the current working directory. I didn&#8217;t want to trash any other prefs. I have to test again but I <strong>think</strong> this should work on 10.10 &#8230; As I found out the hard way x86_64 binaries can <a href="http://stackoverflow.com/questions/26351831/os-x-app-that-runs-on-10-6-to-10-9-doesnt-run-on-10-10-yosemite-why">no longer mess with the zero page</a>, so this is a 32bit only build, but I was running it with my SLiRP fixes ok on my macbook air.</p>
<p>This hasn&#8217;t been extensively tested. I hate to even call it tested, I just copied a few MB of stuff over an NT server running AppleTalk,a nd viewed some flash video with Internet Explorer 5.1 &#8230;. I&#8217;m sure there are PLENTY of things broken. JIT should work with these binaries (Quake 1 is quite playable), but DOOM crashes hard (isn&#8217;t it a 68k binary?). DOOM runs ok on Basilisk II so does it matter?</p>
<p>If you want speed, JIT + SLiRP is the way to go. Since this is basically the same as the version I was using with BasiliskII I think it&#8217;s more stable than the generic version as I could at least run all kinds of programs with some of my fixes vs the &#8216;stock&#8217; github version.</p>
<p>I should add that I&#8217;ve been primarily testing with that PowerMac 9500 v1 ROM, along with MacOS 8.6. I found 8.0 and 8.1 too unstable, 7.x &amp; 9.0.4 uninteresting.</p>
<p>To get around the early crashing while booting 8.6, I rigged it to drop the first 30 packets. I&#8217;ve successfully booted 10/10 times, so I&#8217;m almost OK with that. I&#8217;d rather know when the OS is ok, and go with that, but I&#8217;m not sure. I thought about a timer, and say ignore the network for the first 30 seconds, and maybe that is the better way to go. When you launch this you&#8217;ll see some message updating about packets and &#8220;wait for 30-&gt;&#8221; and a number&#8230; once it reads &#8220;wait for 30-&gt;30&#8221; , the message will no longer update, and it&#8217;ll start to forward packets into the machine. You probably will have to disable and re-enable AppleTalk from the chooser to see the network (or I had to). You may have to get creative to generate the needed packets on your network to get it over 30, as those are packets received. Broadcast packets work too, so maybe you can work with that&#8230; As long as Sheep Shaver isn&#8217;t alone something should be looking for other devices.</p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2014/11/06/sheepshaver-with-pcap-support/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
