Turning on IPv6

So, recently Apple put out an AppStore notice saying (if I understand it correctly) that all services must call endpoints (e.g. API endpoints) that support IPv6 only networking.

This means we have to figure out how to turn on IPv6 in AWS (primarily). This turns out to be fairly straight forward, but there’s a few tricks.

Firstly, we need to assign IP addresses to our instances (or ELB’s). In order to do this, we first need to assign IPv6 addresses to the VPC, then to the subnet, then make sure the routing rules are in the subnet range for ::/0 (the IPv6 version of 0.0.0.0/0) and finally ensure that the IPv6 security group rules are in place. Basically, the best AWS guide can be found here: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-migrate-ipv6.html

But it still gets a few things wrong. Namely, if you want the instance to be publicly available, you shouldn’t add a rule to route through the Egress-Only Gateway, rather just have it go through the regular gateway.

Also, the config on the instance (for Ubuntu) you have to make it:

# The primary network interface
auto eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp

You can also manually trigger DHCPv6 with:

dhclient -6

Which will use DHCP to get both a IPv4 and IPv6 address. Once the addresses are assigned, you can see it in the output of “ip addr”:

ubuntu@ip-10-0-0-78:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 06:cf:f8:b1:c4:e9 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.78/24 brd 10.0.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2600:1f18:21b3:2d01:c71e:7a45:a073:1e1d/128 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::4cf:f8ff:feb1:c4e9/64 scope link
       valid_lft forever preferred_lft forever

So, once the instances have IPv6 addresses, you need to make note of the address and then add DNS AAAA records for them. Once that’s done, you can test connectivity with the following commands:

curl -v -g -6 http://[2600:1f18:21b3:2d01:3d0:d960:f613:ee43]/

curl -v -g -6 https://blog.dukic.co.nz/

ping6 ipv6.google.com

route -6

traceroute6 blog.dukic.co.nz

Turning on IPv6 on DigitalOcean was a lot simpler, but involved setting up a static IPv6 IP and gateway.

Helpful links for IPv6:

 

Network Printing Part 2 – the ‘lpr’ method

Now that we know how to get the ip address of the printer and how to send files to it, lets examine another way of sending files to the printer. The ‘lpr’ method.

What is lpr? You might well ask. A full description can be found here and here. Basically ‘lpr’ is a client printing program which sends files to the server printing program, ‘lpd’. An example of how an actual print server is set up can be found at this support site, where they tell staff how to set up their own computers to work with the university printers.

The thing about network printers is that some of them have built in lpd functionality. Meaning that they act like their own lpd server, accepting files sent by the client program, lpr. So to send the file using lpr type (in the command line):

lpr -S [ip address of printer] -P [ip address of printer] [path to your printable file]

and voila! the document prints.

Network Printing Part 2 – the ‘ftp’ method

One of the properties of a network is that any device on the network can send files to any other device on the network (unless the router is configured to block traffic). This means that bypassing the print server (computer next to the printer) becomes as easy as figuring out the ip address of the printer and sending it the file. Finding out the ip address of the printer is relatively easy. Most printers have a function to print out their settings. So in order to find the ip address, just browse through the menu on the front panel of the printer until you find an option which says ‘print configuration/settings’ and the printed page should have the ip address of the printer.

The next step is to get the file we want to print into the right format. To do this in Adobe Acrobat, simply go to the regular print page and place a tick in the ‘print to file’ tickbox in the bottom left hand corner. The file will appear in the same place as the original document. Now to send the file to the printer. First:

Open an FTP connection to the printer, (at the command line) type:

ftp open [the ip address of the printer]

Once you establish the connection, send the file:

put [path to the printable file]

And that’s it! The printer should automatically print the file upon receiving it, no login, no charge.

Network Printing Part 1 – How it works

The printers in the computer science labs (and most of the university) are network printers. One of the properties of network printers is that they function just like any other device on the network i.e. they are each assigned an ip address. The printer is a simple device, its only function is receiving files and then printing them, therefore a printer by itself doesn’t have the functionality to restrict access to it by ip address or by any other method. Printers also cannot be used to run any custom software e.g. software which logs you in and charges you NetAccount for the printnig costs. This poses a problem for the university, who would like to charge users for printing files. So, in order to solve this problem, when you print from any of the lab machines, the file to be printed is not sent directly to the printer but is in fact sent to the print server (the computer next to the printer). This computer has the job of logging you in and charging you before sending the file to the printer.

The printer itself receives files in one of two ways. Either:

1. a file is sent through the ftp protocol to the printer (the printer has a simple ftp server)

or

2. a file is sent directly to the printer port of the printer