1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
Networking with MOL
===================
MOL networking is configured from /etc/mol/molrc.net. MOL supports three different
network drivers:
1. SheepNet driver
2. TUN driver
3. TAP driver
By default MOL is configured to use the SheepNet driver for AppleTalk and the
TUN driver for TCP/IP.
1. SheepNet driver
==================
Configuration of this driver is simple. Just make sure the config file contains
something similar to
netdev: eth0 -sheep
The sheep net driver shares the specified Ethernet interface between MOL and MacOS.
The network topology typically looks like follows:
130.237.226.235
mol (sheep_net)
|
-Ethernet-----------------------------------------
| |
linux (eth0) other_machine
130.237.226.234 130.237.226.239
That is, MOL looks like a separate host on the network. In particular, a TCP/IP number
different than the one used by the linux host must be used. If IP numbers are obtained
though DHCP, this might be a problem.
The sheep_net driver works well with AppleTalk. It is recommended that the sheep_net
driver is used exclusively for AppleTalk (the tun driver performs better for TCP/IP).
1. TUN driver
=============
The TUN driver provides networking through the use of an IP tunnel. It is configured
by the line
netdev: tun0 -tun
The network topology will look similar to the following example:
-Ethernet----------------------------------------
| |
130.237.226.234 | 130.237.226.239
eth0 | other_machine
linux
tun0 |
192.168.41.1 |
| virtual
+--- ip-tunnel ------- mol
192.168.41.2
That is, the linux box typically has two configured network interfaces: eth0 and tun0.
The virtual tun network should use local IP addresses (these IP numbers have no meaning
to external hosts).
Unfortunately, mol can not connect to external hosts in the above setup (precisely
because external hosts do not know that the 192.168.1.2 address sits behind the
130.237.226.234 box).
The solution to this problem is NAT (network address translation, also called
IP-masquerading). In this case we want to make it appear as if packets sent from
MOL to an external host really originate from the linux box (an external host know
how to reach 130.237.226.234 and linux forwards packets to MOL whenever appropriate).
MOL normally configures NAT automatically from the /etc/mol/tunconfig script.
For reference, it basically does the following:
/sbin/iptables -t nat -s 192.168.41.0/24 -d ! 192.168.41.1
-A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
The client side of the network is usually configured automatically by the built-in
DHCP server. It should look something like the following:
IP: 192.168.41.2
Netmask: 255.255.255.0
Gateway: 192.168.41.1
Nameserver: 192.168.41.1 (or whatever)
By defaul, MOL adds an alias NAT rule which redirects nameserver queries to
the linux host (192.168.41.1) to the first entry in /etc/resolv.conf.
The following kernel configurations should be enabled for NAT to work
properly (nowadays, this is usually included in the default configuration):
Network packet filtering (CONFIG_NETFILTER)
Connection tracking (CONFIG_IP_NF_CONNTRACK)
IP tables support (CONFIG_IP_NF_IPTABLES)
Packet filtering (CONFIG_IP_NF_FILTER)
Full NAT (CONFIG_IP_NF_NAT)
MASQUERADE target support (CONFIG_IP_NF_TARGET_MASQUERADE)
You can check whether the kernel has NAT support by giving the command
/sbin/iptables -t nat -L
as root.
1. TAP driver
=============
Note: The ethertap driver is considered obsolete; use tun instead.
This driver works similar to the TUN driver above although MOL does not autoconfigure
tap devices since they can be configured at boot (the tun device is only alive as
long as MOL is running).
The tap device can be setup by hand as follows:
/sbin/ifconfig tap0 192.168.1.0 netmask 255.255.255.0 arp
/sbin/iptables -t nat -s 192.168.1.0/24 -d ! 192.168.1.1
-A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
The config line in /etc/mol/molrc.net should be:
netdev: tap0 -tap
The MOL/MacOS side shoule be configured as
IP: 192.168.1.2
Netmask: 255.255.255.0
Gateway: 192.168.1.1
Nameserver: whatever
|