[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: redirect apt to local repository



On Wednesday 13 April 2005 20:35, Matt Price wrote:
> hi folks,
>
> Using debmirror, I've downloaded a mirror of the Ubuntu  hoary repository
> to a hard drive.  It works fine in my /etc/apt/sources.list when added with
> a "file://" url.
>
> now, the tricky part.  I wantto deploy this mirror in a classroom
> that's not hooked up to the internet.  We will have a bunch of
> computers connected to a router (running debian I reckon, actually
> haven't set this bit up yet -- any suggestions?), and therefore a
> local network that I hope will work fine.  The computers in the
> network, though, will at some point be removed from the network and
> taken into people's homes.  So I would like to LEAVE sources.list
> POINTING TO http://archive.ubuntu.com , and somehow use the router to
> fool the computers into thinking that they are connecting to ubuntu
> when in fact they're accessing my local repository.
>

I actually do something like this with a router connected to the internet, but 
also running the internal network.  In my case I get 
home.chandlerfamily.org.uk to point to 192.168.0.30 - you try and you will 
see it as my external ip address.  I've changed things now, but I used hide 
my web server behind a NAT router, and would forward port 80 on to 
192.168.0.30 a separate computer inside my network (the reason I've changed 
is nothing to do with this explanation).

You can easily run bind on the on the same machine as the mirror and get it to 
give out archive.ubuntu.com as the internal ip address of the mirror (as well 
as any name you want).  Students in the classroom can be networked but not 
connected to the internet, but also be able to resolve the archive.ubuntu.com 
address.

So what I get is a number of machines on my local lan called xxx.home (where 
xxx are various winnie the pooh characters) and also 
home.chandlerfamily.org.uk which inside the lan resolves to the same address 
as webmail.home


Here are the relevent files in /etc/bind for my setup

=========/etc/bind/named.conf.local

zone "home" {
        type master;
        file "/etc/bind/db.home";
};

zone "0.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0.168.192";

};

zone "home.chandlerfamily.org.uk" {
      type master;
      file "/etc/bind/db.home.chandlerfamily";
};

========/etc/bind/db.home
;       $Id: db.home,v 1.1 2002/11/11 16:26:10 alan Exp $
; BIND data file for local domain
;
$TTL    604800
@       IN      SOA     home. root.home. (
                             33         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      roo.home.
@       IN      MX 10   mail.home.
; static allocation
kanger  IN      A       192.168.0.21    ;Study Workstation
pooh    IN      A       192.168.0.22    ;Breakfast Room
; below are allocated via dhcp because of compatibility at university
eeyore  IN      A       192.168.0.23    ; Emily's Portable
piglet  IN      A       192.168.0.24    ; Sarah's Portable
; Special for work portable - must be allocated by dhcp because of
; Work - it uses the mac address to find this address.
rabbit  IN      A       192.168.0.25
;
tigger  IN      A       192.168.0.26    ;  Not Used (old tosh)

;
;  10-20 allocated to dhcpd clients
;
;  Default gateway - static allocation
;
roo     IN      A       192.168.0.20    ;Main machine
mail    IN      CNAME   roo             ;Mail is sent here
www     IN      CNAME   roo             ;Alternate name for internal web

;
;  Web Services Here
;
webmail IN      A       192.168.0.30    ;Sqweb mail
;
test    IN      A       192.168.0.39    ;Test web site

;
owl     IN      A       192.168.0.10    ;Network Gateway
wol     IN      CNAME   owl
gateway IN      CNAME   owl

gopher  IN      A       192.168.0.11    ;Wireless Router
small   IN      CNAME   gopher
wirenet IN      CNAME   gopher

========/etc/bind/db.home.chandlerfamily

;       $Id: db.home,v 1.1 2002/11/11 16:26:10 alan Exp $
; BIND data file for local domain
;
$TTL    604800
@       IN      SOA     home.chandlerfamily.org.uk. 
root.home.chandlerfamily.org
.uk. (
                              5         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      home.chandlerfamily.org.uk.
home.chandlerfamily.org.uk.     IN      A       192.168.0.30    ;Main machine






-- 
Alan Chandler
http://www.chandlerfamily.org.uk



Reply to: