View previous topic :: View next topic |
Author |
Message |
legabier Apprentice
Joined: 30 Aug 2004 Posts: 231
|
Posted: Wed Sep 06, 2006 8:11 am Post subject: [Réseau] Deuxième machine sur mon LAN (résolu) |
|
|
Bonjour,
Mon Gentoo est un routeur. eth1 est le WAN, eth0 et eth2 le LAN.
eth0 fonctionne parfaitement depuis un an. Mon problème est que je n'arrive pas à configurer eth2.
J'ai suivi le Guide du routeur personnel pour faire mon routeur il y a un an mais aujourd'hui en suivant les explications pour ajouter des eth juste avant le point 7 du guide, mon dhcpd ne redémarre plus.
Voici à quoi ça ressemble:
# ifconfig
Code: | eth0 Lien encap:Ethernet HWaddr 00:43:82:D2:B4:C8
inet adr:192.168.0.1 Bcast:192.168.0.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27882 errors:0 dropped:0 overruns:0 frame:0
TX packets:32494 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:3864723 (3.6 Mb) TX bytes:4992061 (4.7 Mb)
Interruption:11
eth1 Lien encap:Ethernet HWaddr 00:C2:23:65:D2:A1
inet adr:123.123.123.123 Bcast:255.255.255.255 Masque:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:265428 errors:1 dropped:0 overruns:0 frame:0
TX packets:180106 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:124820672 (119.0 Mb) TX bytes:118931281 (113.4 Mb)
Interruption:11
eth2 Lien encap:Ethernet HWaddr 00:36:84:41:E3:C8
inet adr:192.168.2.1 Bcast:192.168.2.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interruption:11 Adresse de base:0xe000
lo Lien encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:36206 errors:0 dropped:0 overruns:0 frame:0
TX packets:36206 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:2493454 (2.3 Mb) TX bytes:2493454 (2.3 Mb) |
Je crois avoir ajouté eth2 aux bons endroits dans mes règles iptables, mais est-ce 192.168.0.0/16 ou 192.168.2.0/16 dans le FORWARD pour eth2?
Code: | Chain INPUT (policy ACCEPT)
target prot opt in out source destination
ACCEPT all -- lo any anywhere anywhere
ACCEPT all -- eth0 any anywhere anywhere
ACCEPT all -- eth2 any anywhere anywhere
REJECT udp -- !eth0 any anywhere anywhere udp dpt:bootps reject-with icmp-port-unreachable
REJECT udp -- !eth0 any anywhere anywhere udp dpt:domain reject-with icmp-port-unreachable
REJECT udp -- !eth2 any anywhere anywhere udp dpt:bootps reject-with icmp-port-unreachable
REJECT udp -- !eth2 any anywhere anywhere udp dpt:domain reject-with icmp-port-unreachable
DROP tcp -- !eth0 any anywhere anywhere tcp dpts:0:1023
DROP udp -- !eth0 any anywhere anywhere udp dpts:0:1023
DROP tcp -- !eth2 any anywhere anywhere tcp dpts:0:1023
DROP udp -- !eth2 any anywhere anywhere udp dpts:0:1023
DROP all -f eth1 any anywhere anywhere
DROP tcp -- eth1 any anywhere anywhere tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,SYN,RST,ACK
DROP tcp -- eth1 any anywhere anywhere tcp flags:FIN,SYN/FIN,SYN
DROP tcp -- eth1 any anywhere anywhere tcp flags:SYN,RST/SYN,RST
Chain FORWARD (policy DROP)
target prot opt in out source destination
DROP all -- eth0 any anywhere 192.168.0.0/16
ACCEPT all -- eth0 any 192.168.0.0/16 anywhere
DROP all -- eth2 any anywhere 192.168.0.0/16
ACCEPT all -- eth2 any 192.168.0.0/16 anywhere
ACCEPT all -- eth1 any anywhere 192.168.0.0/16 |
Mon /etc/conf.d/net
Code: | config_eth1=( "dhcp" )
config_eth0=( "192.168.0.1/24 brd 192.168.0.255" )
config_eth2=( "192.168.2.1/24 brd 192.168.2.255" ) |
# route -n
Code: | Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
123.123.123.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 123.123.123.1 0.0.0.0 UG 0 0 0 eth1 |
/etc/dnsmasq.conf (seuls les deux premières étaient là avant)
Code: | domain-needed
bogus-priv
interface=eth0
interface=eth2
dhcp-range=192.168.0.100,192.168.0.250,72h
dhcp-range=192.168.2.100,192.168.2.250,72h |
/etc/dhcp/dhcpd.conf (rien modifié)
Code: | authoritative;
ddns-update-style interim;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.250;
default-lease-time 259200;
max-lease-time 518400;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
} |
Et ça ne fonctionne pas, dhcpd ne démarre plus.
Merci pour toutes vos suggestions! _________________ Néophyte ou novice, telle est la question...
Last edited by legabier on Wed Sep 06, 2006 11:26 pm; edited 1 time in total |
|
Back to top |
|
|
-KuRGaN- Veteran
Joined: 05 Dec 2004 Posts: 1142 Location: Besançon (25) [FRANCE]
|
Posted: Wed Sep 06, 2006 8:36 am Post subject: |
|
|
Si ton dhcpd ne démarre plus, tu pourrais nous poster les logs de ce service histoire d'avoir un peu plus de renseignements. _________________ Knight Gent00 Industries RiDeR !!!! |
|
Back to top |
|
|
legabier Apprentice
Joined: 30 Aug 2004 Posts: 231
|
Posted: Wed Sep 06, 2006 8:40 am Post subject: |
|
|
-KuRGaN- wrote: | Si ton dhcpd ne démarre plus, tu pourrais nous poster les logs de ce service histoire d'avoir un peu plus de renseignements. |
Code: | dhcpd: Can't bind to dhcp address: Address already in use
dhcpd: Please make sure there is no other dhcp server
dhcpd: running and that there's no entry for dhcp or
dhcpd: bootp in /etc/inetd.conf. Also make sure you
dhcpd: are not running HP JetAdmin software, which
dhcpd: includes a bootp server.
dhcpd: exiting. |
_________________ Néophyte ou novice, telle est la question... |
|
Back to top |
|
|
-KuRGaN- Veteran
Joined: 05 Dec 2004 Posts: 1142 Location: Besançon (25) [FRANCE]
|
Posted: Wed Sep 06, 2006 8:56 am Post subject: |
|
|
En fait je pense que tu as un souçis car ton dnsmasq fait serveur dhcp et c'est pour ça que le service dhcpd gueule!
Pourquoi as-tu besoin de deux serveur dhcp ???
Je pense que tu devrais en supprimer un car là ça fout la zone. _________________ Knight Gent00 Industries RiDeR !!!! |
|
Back to top |
|
|
legabier Apprentice
Joined: 30 Aug 2004 Posts: 231
|
Posted: Wed Sep 06, 2006 8:59 am Post subject: |
|
|
-KuRGaN- wrote: | En fait je pense que tu as un souçis car ton dnsmasq fait serveur dhcp et c'est pour ça que le service dhcpd gueule!
Pourquoi as-tu besoin de deux serveur dhcp ???
Je pense que tu devrais en supprimer un car là ça fout la zone. |
Comment je fais ça?
Le reste de ma config est-elle correct? _________________ Néophyte ou novice, telle est la question... |
|
Back to top |
|
|
-KuRGaN- Veteran
Joined: 05 Dec 2004 Posts: 1142 Location: Besançon (25) [FRANCE]
|
Posted: Wed Sep 06, 2006 10:18 am Post subject: |
|
|
Et bien tu supprime un des deux services. Je te conseille de supprimer dhcpd et de ne garder que dnsmasq, tu te feras moins chier an niveau DNS.
Alors pour virer dhcpd tu fais:
Code: |
/etc/init.d/dhcpd stop
rc-update del dhcpd default # le service ne serat plus lancer au démarrage
|
Ne le supprime pas de suite ( emerge -C dhcpd), regarde avant si la config avec dnsmasq te convient. _________________ Knight Gent00 Industries RiDeR !!!! |
|
Back to top |
|
|
legabier Apprentice
Joined: 30 Aug 2004 Posts: 231
|
Posted: Wed Sep 06, 2006 11:40 am Post subject: |
|
|
Ça semble fonctionner, j'observerai le tout durant les prochaines heures, merci! _________________ Néophyte ou novice, telle est la question... |
|
Back to top |
|
|
-KuRGaN- Veteran
Joined: 05 Dec 2004 Posts: 1142 Location: Besançon (25) [FRANCE]
|
Posted: Wed Sep 06, 2006 11:48 am Post subject: |
|
|
N'oublie pas de mettre (résolu) ds ton titre si cela fonctionne _________________ Knight Gent00 Industries RiDeR !!!! |
|
Back to top |
|
|
legabier Apprentice
Joined: 30 Aug 2004 Posts: 231
|
Posted: Wed Sep 06, 2006 10:45 pm Post subject: |
|
|
Mes deux ordis reçoivent une IP mais pas la même que lorsque dhcpd l'attribuait, ce qui fausse toutes mes règles NAT dans iptables.
Comment configurer dnsmasq.conf pour attribuer toujours la même IP selon la MAC adresse? (man dnsmasq.conf n'existe pas ) _________________ Néophyte ou novice, telle est la question... |
|
Back to top |
|
|
loopx Advocate
Joined: 01 Apr 2005 Posts: 2787 Location: Belgium / Liège
|
Posted: Wed Sep 06, 2006 10:58 pm Post subject: |
|
|
Tu faisais comment avant ? T'aurais pas plutot configuré ton dhcpd correctement ? Si oui, change de dhcp, stop l'autre et lance le dhcpd
Pour ton probz iptable, ben oui, faut attribuer une ip en fonction de la mac. Moi j'utilise dhcpd ainsi:
Code: |
serveur loopx # cat /etc/dhcp/dhcpd.conf
option domain-name "blabla.com";
option domain-name-servers 10.2.1.62;
option routers 10.2.1.62;
option broadcast-address 10.2.1.63;
ddns-update-style ad-hoc;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 10.2.1.0 netmask 255.255.255.192 {
range 10.2.1.40 10.2.1.50;
}
host loop-nb {
hardware ethernet 00:0E:35:AB:05:22;
fixed-address 10.2.1.1;
}
host nico {
hardware ethernet 00:04:23:66:00:C3;
fixed-address 10.2.1.2;
}
|
_________________ Mon MediaWiki perso : http://pix-mania.dyndns.org |
|
Back to top |
|
|
legabier Apprentice
Joined: 30 Aug 2004 Posts: 231
|
Posted: Wed Sep 06, 2006 11:25 pm Post subject: |
|
|
loopx: J'ai suivi le conseil de -KuRGaN-, je n'utilise plus dhcpd, j'utilise dnsmasq uniquement.
J'ai trouvé ma réponse pour attribuer une adresse IP spécifique selon la MAC:
J'ai ajouté cette ligne dans mon dnsmasq.conf:
Code: | dhcp-host=00:43:82:D2:B4:C8,192.168.0.99 |
_________________ Néophyte ou novice, telle est la question... |
|
Back to top |
|
|
loopx Advocate
Joined: 01 Apr 2005 Posts: 2787 Location: Belgium / Liège
|
|
Back to top |
|
|
|