[Dnsmasq-discuss] 2 dnsmasq instances
David Sankel
David Sankel <camior@gmail.com>
Wed, 22 Jun 2005 18:56:43 +0200
------=_Part_4186_14393107.1119459403797
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello All,
I've been able to run a duel dnsmasq server configuration a while ago.
That computer crashed and I'm rebuilding it. I don't recall what
dnsmasq version I was using then, but I get the following error
message with both 2.20 and 2.22. It happens when the second instance
is started.
failed to bind listening socket: Address already in use.
Do I need to do something else to my configuration files to get it
working with the latest version?
David J. Sankel
------=_Part_4186_14393107.1119459403797
Content-Type: application/octet-stream; name=dnsmasq-freenet.conf
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="dnsmasq-freenet.conf"
# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
pid-file=/var/run/dnsmasq-freenet.pid
dhcp-leasefile=/var/state/dnsmasq/dnsmasq-freenet.leases
domain-needed
bogus-priv
filterwin2k
interface=eth0.3
bind-interfaces
no-hosts
addn-hosts=/etc/hosts-freenet
expand-hosts
domain=freenet
dhcp-range=freenet,192.168.1.50,192.168.1.150,12h
dhcp-host=00:0d:54:a0:b1:bb,accesspoint1,192.168.1.3,12h
address=/accesspoint2.freenet/192.168.1.4
------=_Part_4186_14393107.1119459403797
Content-Type: application/octet-stream; name=dnsmasq-offices.conf
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="dnsmasq-offices.conf"
# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
pid-file=/var/run/dnsmasq-offices.pid
dhcp-leasefile=/var/state/dnsmasq/dnsmasq-offices.leases
domain-needed
bogus-priv
filterwin2k
interface=eth0.2
bind-interfaces
no-hosts
addn-hosts=/etc/hosts-offices
expand-hosts
domain=offices
dhcp-range=192.168.10.50,192.168.10.70,12h
dhcp-host=00:0f:1f:40:f1:1a,dellswitch,192.168.10.5,12h
dhcp-host=00:0b:cd:cf:a0:2a,central,192.168.10.1,12h
dhcp-host=00:00:85:0a:ea:23,ir2200,192.168.10.40,12h
------=_Part_4186_14393107.1119459403797
Content-Type: application/octet-stream; name=rc.dnsmasq
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="rc.dnsmasq"
#!/bin/sh
# Start/stop/restart dnsmasq (a small DNS/DHCP server):
# Start dnsmasq:
dnsmasq_start() {
if [ -x /usr/sbin/dnsmasq ]; then
echo "Starting dnsmasq: /usr/sbin/dnsmasq"
/usr/sbin/dnsmasq --conf-file /etc/dnsmasq-offices.conf
/usr/sbin/dnsmasq --conf-file /etc/dnsmasq-freenet.conf
fi
}
# Stop dnsmasq:
dnsmasq_stop() {
killall dnsmasq
}
# Restart dnsmasq:
dnsmasq_restart() {
dnsmasq_stop
sleep 1
dnsmasq_start
}
case "$1" in
'start')
dnsmasq_start
;;
'stop')
dnsmasq_stop
;;
'restart')
dnsmasq_restart
;;
*)
echo "usage rc.dnsmasq: start|stop|restart"
esac
------=_Part_4186_14393107.1119459403797
Content-Type: application/octet-stream; name=rc.inet1
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="rc.inet1"
#!/bin/sh
# DJS: this is based on something from radom.org
start()
{
### lo ###
ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo
ip link set lo up
### eth0 and VLANS ###
ip link set eth0 up
baspcfg addteam 0 0 myteam
baspcfg bind 0 0 eth0
baspcfg addva 0 2 eth0.2
baspcfg addva 0 3 eth0.3
baspcfg addva 0 4 eth0.4
#vconfig add eth0 2
#vconfig add eth0 3
#vconfig add eth0 4
#office network
ip address add \
dev eth0.2 \
local 192.168.10.250/24 \
broadcast +
ip link set eth0.2 up
#freenet network
ip address add \
dev eth0.3 \
local 192.168.1.2/24 \
broadcast +
ip link set eth0.3 up
#internet
ip address add \
dev eth0.4 \
local 192.168.0.2/24 \
broadcast +
ip link set eth0.4 up
## routes ##
ip route add 127.0.0.0/8 dev lo
ip route add default via 192.168.0.1 dev eth0.4
}
stop()
{
ip link set lo down
ip link set eth0.4 down
ip link set eth0.3 down
ip link set eth0.2 down
ip link set eth0 down
ip addr flush lo
ip addr flush eth0.4
ip addr flush eth0.3
ip addr flush eth0.2
baspcfg delva 0 2
baspcfg delva 0 3
baspcfg delva 0 4
baspcfg unbind 0 eth0
baspcfg delteam 0
#vconfig rem eth0.4
#vconfig rem eth0.3
#vconfig rem eth0.2
}
status()
{
ip addr show
echo ""
echo ""
ip route show
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "usage: $0 ( start | stop | status | restart )"
exit 1
esac
------=_Part_4186_14393107.1119459403797--