Posts Tagged: ubuntu


12
Dec 06

Debian, at long last

Around a month ago, I attempted setting up Debian on my computer again. Because of trouble getting X to run, though, and school work starting to pile up again, I eventually went back to using Ubuntu. Mistakes, attempts, and then there was this day I installed Windows XP on a whim because I was dying to continue experiencing the seventh final fantasy (It is my first time.) and had zero patience to try to get a PlayStation emulator to work well on my system. Weeks went by.

Last night, again on a whim, I decided to back up my data, clear my hard disk (just the partition table, actually), partition my hard disk exactly the way I realized I wanted it, and then install Debian again. It was either “do” or “die for a while”, just decide what to do afterwards if I still could not get X to work. Surprisingly though, last night, it was so easy – I just did whatever made sense and, before I knew it, X was up. Now, I have Debian, and I am no longer with the haunting thought that my system might be doing things that I really do not want it to do. And since I am on that, here is a bit that I wrote some weeks ago:

I am not against Ubuntu, I think it is a great desktop system. In fact, I still recommend it to a lot of people who are interested in open source software and/or GNU/Linux. However, for myself, I still prefer Debian. I itch not knowing my system, and I am more comfortable with more direct control of it: I want to know what software I have running, what packages I have installed, and the actual configuration of the services I run.

I think it boils down to what is user-friendly for the specific user. Ubuntu may be user-friendly for the regular users, but Debian is for the developers, the (computer) geeks, systems administrators, and the paranoid. I find that hitting that aspect of the Ubuntu vs. Debian issue is pointless.

Then, of course, window manager galore. I now understand why Paolo spends weeks tweaking window manager after window manager just to get the environment that he wants. I am on a Debian high.


6
Jul 06

Sharing an Internet connection

I was finally able to set up my computer as a gateway to share an Internet connection yesterday.

I had no idea what I was doing wrong at first because I thought that the only thing that needed to be done was network address translation to make packets from the other computers appear as if they came from my computer. I was really confused because I could communicate with the first network interface of my computer from computers connected to the second interface, but I was not getting anything in my iptables FORWARD chain. I tested with several setups, seeing which packets went through which chains, until I realized that there had to be something disallowing packet-forwarding, and that after traversing the PREROUTING chain, all the packets that are for any interface, regardless of which interface they came from, are directed to the INPUT chain.

I looked around /proc and saw values that seemed to need toggling. I also checked the descriptions of the /proc files to be sure. Apparently, packet-forwarding is not enabled in the kernel by default. Enabling that, plus source network address translation, did the trick.

Considering an interface eth0 that is assigned 192.168.0.2/16 which is allowed to access the Internet, and an interface eth1 that is assigned 10.71.0.1/24 to which those computers that need an Internet connection are connected, the following procedure may be done:

  1. Set iptables to do source network address translation for packets from eth1 for eth0.
    # iptables -A POSTROUTING -t nat -s 10.71.0.0/24 -d ! 10.71.0.0/24 -j SNAT --to 192.168.0.2
  2. Enable packet-forwarding in your machine.
    # echo -n "1" > /proc/sys/net/ipv4/ip_forward
  3. Allow packet-forwarding for the involved interfaces.
    # echo -n "1" > /proc/sys/net/ipv4/conf/eth0/forwarding
    # echo -n "1" > /proc/sys/net/ipv4/conf/eth1/forwarding
  4. Set the default route of each computer connected to eth1 to the proper address.
    # route add default gw 10.71.0.1

This is, of course, considering that the FORWARD chain already allows connections between 10.71.0.0/24 and 192.168.0.0/16. In a default Ubuntu installation, the FORWARD chain is empty and has a chain policy of ACCEPT, so it should already be okay.