Changes between Initial Version and Version 1 of marcos.mayfirst.org


Ignore:
Timestamp:
Mar 21, 2008, 4:24:17 PM (16 years ago)
Author:
Daniel Kahn Gillmor
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • marcos.mayfirst.org

    v1 v1  
     1= `marcos.mayfirst.org` =
     2
     3`marcos.mayfirst.org` is a simple xen domU hosting a dedicated resolving DNS cache for MF/PL.  It was created in response to #765.
     4
     5It is hosted on [wiki:fred.mayfirst.org].
     6
     7== Creation ==
     8
     9I opted to go with debian lenny, since the new [DebianPackage:djbdns] packages are included upstream, and there will be no other services on the box.
     10
     11{{{
     120 fred:~# lvcreate --name marcos-disk --size 500M vg_fred0
     13  Logical volume "marcos-disk" created
     140 fred:~# mkfs -t ext3 /dev/mapper/vg_fred0-marcos--disk
     15mke2fs 1.40-WIP (14-Nov-2006)
     16Filesystem label=
     17OS type: Linux
     18Block size=1024 (log=0)
     19Fragment size=1024 (log=0)
     20128016 inodes, 512000 blocks
     2125600 blocks (5.00%) reserved for the super user
     22First data block=1
     23Maximum filesystem blocks=67633152
     2463 block groups
     258192 blocks per group, 8192 fragments per group
     262032 inodes per group
     27Superblock backups stored on blocks:
     28        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
     29
     30Writing inode tables: done                           
     31Creating journal (8192 blocks): done
     32Writing superblocks and filesystem accounting information: done
     33
     34This filesystem will be automatically checked every 21 mounts or
     35180 days, whichever comes first.  Use tune2fs -c or -i to override.
     360 fred:~# mount /dev/mapper/vg_fred0-marcos--disk /mnt/
     370 fred:~# debootstrap lenny /mnt/
     38I: Retrieving Release
     39I: Retrieving Packages
     40I: Validating Packages
     41I: Resolving dependencies of required packages...
     42I: Resolving dependencies of base packages...
     43I: Found additional base dependencies: libldap-2.4-2
     44I: Checking component main on http://ftp.debian.org/debian...
     45I: Retrieving adduser
     46 ...[skip boring debootstrap output]...
     47I: Configuring klogd...
     48I: Configuring tasksel...
     49I: Base system installed successfully.
     500 fred:~# echo proc /proc proc defaults 0 0 > /mnt/etc/fstab
     510 fred:~# echo /dev/sda1 / ext3 defaults,errors=remount-ro 0 1 >> /mnt/etc/fstab
     520 fred:~# echo /dev/sda2 none swap sw 0 0 >> /mnt/etc/fstab
     530 fred:~# echo >/mnt/etc/hosts '127.0.0.1 localhost
     54209.51.163.29 marcos.mayfirst.org marcos
     55
     56# The following lines are desirable for IPv6 capable hosts
     57::1     ip6-localhost ip6-loopback
     58fe00::0 ip6-localnet
     59ff00::0 ip6-mcastprefix
     60ff02::1 ip6-allnodes
     61ff02::2 ip6-allrouters
     62ff02::3 ip6-allhosts
     63'
     640 fred:~# echo marcos > /mnt/etc/hostname
     650 fred:~# cp -a {,/mnt}/etc/network/if-up.d/add-he-routes
     660 fred:~# cp -a {,/mnt}/etc/network/if-down.d/remove-he-routes
     670 fred:~# emacs /mnt/etc/network/if-*.d/*-he-routes ## fix up to repair IP addresses and network interface designations
     680 fred:~# lvcreate --size=200MB --name=marcos-swap vg_fred0
     69  Logical volume "marcos-swap" created
     700 fred:~# mkswap /dev/mapper/vg_fred0-marcos--swap
     71Setting up swapspace version 1, size = 209711 kB
     72no label, UUID=1fe97b9d-445b-458c-891b-925d23dfaa80
     730 fred:~# umount /mnt
     740 fred:~#
     75}}}
     76
     77Setting up the xen config:
     78{{{
     790 fred:~# grep '^[^#]' /etc/xen/marcos
     80kernel  = '/boot/vmlinuz-2.6.18-6-xen-amd64'
     81ramdisk = '/boot/initrd.img-2.6.18-6-xen-amd64'
     82memory  = '64'
     83root    = '/dev/sda1 ro'
     84disk    = [ 'phy:vg_fred0/marcos-disk,sda1,w', 'phy:vg_fred0/marcos-swap,sda2,w' ]
     85name    = 'marcos'
     86vif  = [ 'ip=209.51.163.29' ]
     87on_poweroff = 'destroy'
     88on_reboot   = 'restart'
     89on_crash    = 'restart'
     900 fred:~#
     91}}}
     92
     93Within the domU, once it was started, i did:
     94{{{
     95aptitude install iproute less lsof emacs22-nox psmisc screen runit djbdns
     96}}}
     97
     98I don't appear to need the kernel modules for this machine, since it is a dedicated host.
     99
     100Setting up the actual resolving name service:
     101{{{
     1020 marcos:~# lsof -i
     1031 marcos:~# adduser --system dnslog
     104Adding system user `dnslog' (UID 100) ...
     105Adding new user `dnslog' (UID 100) with group `nogroup' ...
     106Creating home directory `/home/dnslog' ...
     1070 marcos:~# adduser --system dnscache
     108Adding system user `dnscache' (UID 101) ...
     109Adding new user `dnscache' (UID 101) with group `nogroup' ...
     110Creating home directory `/home/dnscache' ...
     1110 marcos:~# dnscache-conf dnscache dnslog /srv/dnscache 209.51.163.29
     1120 marcos:~# ln -s /srv/dnscache /etc/service
     1130 marcos:~# lsof -i
     114COMMAND   PID     USER   FD   TYPE DEVICE SIZE NODE NAME
     115dnscache 1536 dnscache    3u  IPv4   4816       UDP marcos.mayfirst.org:domain
     116dnscache 1536 dnscache    4u  IPv4   4817       TCP marcos.mayfirst.org:domain (LISTEN)
     1170 marcos:/srv/dnscache/root/ip# ip route
     118209.51.163.192/28 dev eth0  scope link  src 209.51.163.29
     119209.51.180.16/28 dev eth0  scope link  src 209.51.163.29
     120209.51.172.0/28 dev eth0  scope link  src 209.51.163.29
     121209.51.169.80/28 dev eth0  scope link  src 209.51.163.29
     122209.51.163.0/27 dev eth0  proto kernel  scope link  src 209.51.163.29
     123default via 209.51.163.1 dev eth0
     1240 marcos:~# ls /srv/dnscache/root/ip/ | wc -l
     1251
     1260 marcos:~# for BASE in 209.51.163.192 209.51.180.16 209.51.172.0 209.51.169.80 209.51.163.0 209.51.163.16; do for INC in $(seq 0 15) ; do LAST=${BASE#*.*.*.}; NEW=/srv/dnscache/root/ip/${BASE%.*}.$(( $LAST + $INC )); if [ ! -e $NEW ]; then touch $NEW; fi; done; done
     1270 marcos:~# ls /srv/dnscache/root/ip/
     12897
     1290 marcos:~#
     130}}}