I've got 2 PCs connected on an Ethernet crossover cable. On PC1 I run:sudo ip addr add 192.168.2.1 peer 192.168.2.2 dev eth0sudo ip link set dev eth0 upOn PC2 I run:sudo ip addr add 192.168.2.2 peer 192.168.2.1 dev eth0sudo ip link set dev eth0 upsudo ip route add default via 192.168.2.1What's the cleanest way to replicate this set up in the interfaces(5) config file, so I can run ifup(8) instead of configuring each interface manually?I'm on Linux Mint 15, if it matters, but I'd think it'd be the same in any Debian-based distro.
Static IP for 2 PCs on crossover cable in interfaces(5) file?
debian;networking;linux mint;configuration;ip
Here's the interfaces(5) native way to describe a point-to-point connection (written for PC2):iface eth0 inet static    address 192.168.2.2    pointopoint 192.168.2.1    gateway 192.168.2.1It's also useful to know that in a pinch, if you have an unusual configuration that interfaces(5) doesn't support, you can tell it to run exactly your set of commands:iface eth0 inet manual    up ip link set eth0 up    up ip addr add 192.168.2.2 peer 192.168.2.1 dev eth0    up ip route add default via 192.168.2.1    down ip route del default via 192.168.2.1    down ip addr del 192.168.2.2 peer 192.168.2.1 dev eth0    down ip link set eth0 downThis way is more error-prone, of course, and in this instance it's unnecessary.  But you can also add up and down to non-manual definitions, if you want to tweak a standard setup.