Dear Nerds,
Networking on IRIX can be fiddly. I've seen a lot of HOWTO and best practices and I've seen shortcuts too. I figured I might put down the way I configure my hosts here in case anyone else has any fun or useful advice. If I make any assumptions then they are as they are and I'm open to constructive criticism.
First of all, you have the actual hostname of your
IRIS. Out of the box, the /etc/hosts file comes with the default
192.0.2.1 /32 host address. This is done because RFC5737 and RFC 6890 designate a bunch of IPv4 address spaces as 'Special Use'. In fact, the
192.0.2.0/24 is reserved for Documentation and not as we usually use
192.168.0.0/16 which is reserved for Private-Use and you'd normally have in your house. If you want to have a read about all the IPv4 space that is reserved you can checkout
IETF RFC 6890
So yeah, the hostname, designated in
/etc/sys_id.
If you concatenate /etc/sys_id you'll see the name
IRIS.
Now you can take a look at the hosts file
/etc/hosts. You'll see a line similar to this:
So when you boot your SGI it looks for the name in the /etc/sys_id file then looks for that name in the /etc/hosts to get your IP address. If you change the hostname to bob for example and then add bob to /etc/hosts with a different IP address, your box will start to use the new IP address for the first network interface, typically ec0 (eg0).
You may be wondering where the network mask bit goes. Well, the network mask for the subnet 192.0.2.1 falls into what used to be known as a classful network and therefore by default inherits the 255.255.255.0 (a.k.a. /24 or 0xffffff00). From my experience, any IPv4 address you use here will inherit a default mask from the old classful network style. For example, if you use a 172.16.0.0/12 address then you'll get a /16 (255.255.0.0) mask. This can be awkward but thankfully can be overridden.
The default mask as I said is usually pulled from the old classful mask but you can override the behaviour by creating (or editing) the file /etc/config/ifconfig-ec0.options. If your network interface is different than ec0 (e.g. ec1 or eg0) then adjust as necessary on the filename. This is also the file you would create if you have more than one network interface card to configure. I've copy and pasted the output from mine below. You can see I use a different IPv4 address from the Special-Use pool. I use this because it reminds me of a public internet address and helps me in my home lab environment. The interesting thing here is the netmask.
Code:
richard@marvin [config]: cat ifconfig-ec0.options
203.0.113.12 netmask 0xfffffff8
As we mentioned earlier, the netmask is typically taken as a classful. That is either 255.0.0.0, 255.255.0.0 or 255.255.255.0 for classes A, B and C respectively. The way IRIX displays the netmask is rather different because instead of binary they use HEX decimal notation. For each letter there are 4 bits whereas for binary to decimal we use 8-bits.
DECIMAL: 255
BINARY: 1111 1111
HEX: FF
In most cases, you'll likely be using a /24 mask which in BINARY is 11111111.11111111.11111111.00000000 or in HEX is FF:FF:FF:00 (0xffffff00). In my example above, I'm using a smaller subnet size of DECIMAL 248 which works out as F8 in HEX. So if you have a smaller (or larger) subnet then you just need to edit this file and tell IRIX what mask to use.
The last nugget I can offer regards gateways. Normally, your subnet will have a single gateway which would most likely be your home router. Sometimes however you may need to route some traffic to the internet and some traffic to your home LAN or elsewhere. To add default and/or another gateway(s) you need to edit the file /etc/config/static-route.options.
Code:
richard@marvin [config]: cat /etc/config/static-route.options
$ROUTE $QUIET add net default 203.0.113.9
In my case, my home router has the IPv4 address 203.0.113.9. Your home router is maybe 192.168.0.1 or similar. If you need to add a new route to a destination via a different gateway (router) then simply add it to this file. Again, noting the network mask is very important. Let's say I want to route traffic to destination network 8.8.8.0 via a different router with IPv4 address 203.0.113.10. I edit the file /etc/config/static-route.options, add the line I need and then save it.
Code:
$ROUTE $QUIET add net default 203.0.113.9
$ROUTE $QUIET add net 8.8.8.0/24 203.0.113.10
In this case note, I used the /24-bit notation rather than the HEX notation. You can check your configuration works by running the networking init script or rebooting your box. In the CLI issue the 'netstat -rn' command and look at the default Destination and Gateway output.
Code:
richard@marvin [~]: netstat -rn
Routing tables
Internet:
Destination Gateway Netmask Flags Refs Use Interface
default 203.0.113.9 UGS 2 0 ec0
8.8.8 203.0.113.10 0xffffff00 UGS 0 0 ec0
127.0.0.1 127.0.0.1 UH 10 4 lo0
203.0.113 link#1 0xffffff00 UC 0 0 ec0
203.0.113.12 127.0.0.1 UGHS 1 0 lo0
224 link#1 0xf0000000 UCS 0 0 ec0
255.255.255.255 203.0.113.255 UGHS 0 0 ec0
I hope this was somewhat helpful to anyone stumbling into networking drama. IRIX also understands the RIP routing protocol and I could write about that if anyone is interested. Most people tend to have these boxes at home nowadays and home routers don't tend to support RIP whereas in the 90's when I worked on these boxes I used RIP a lot.
All the best
Rich
EDIT: Typos