Ok alors on va commencer par les paramètres du serveur principal :
Ce que le dig a donné :
[code]; <<>> DiG 9.7.3 <<>> -t any www.monsite.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64069
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.monsite.com. IN ANY
;; ANSWER SECTION:
www.monsite.com. 5 IN CNAME host.monsite.com.
;; Query time: 239 msec
;; SERVER: 192.168.117.2#53(192.168.117.2) ==> Trés bizarre j’ai jamais configuré cette IP la…
;; WHEN: Sat Dec 8 08:47:07 2012
;; MSG SIZE rcvd: 51[/code]
Le firewall :
[code]#! /bin/sh
BEGIN INIT INFO
Provides: firewall
Required-Start: $local_fs $remote_fs
Required-Stop: $local_fs $remote_fs
Should-Start: $network $syslog
Should-Stop: $network $syslog
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: Start/stop firewall
Description: Start/stop firewall, a script to set/unset your custom firewall rules
END INIT INFO
IPT=/sbin/iptables
Function that set the firewall rules
set_rules()
{
# On réinitialise le firewall
flush_rules
# On autorise les connexions dont l’état est RELATED ou ESTABLISHED
$IPT -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
# On autorise le serveur à répondre aux requêtes ICMP (ping)
$IPT -A INPUT -i eth0 -p icmp -j ACCEPT
# !! ACCES SSH !! NE PAS COMMENTER CETTE LIGNE !!
$IPT -A INPUT -i eth0 -p tcp --dport xxxx -j ACCEPT
# INTERFACE GRAPHIQUE/WEB de PROXMOX
$IPT -A INPUT -i eth0 -p tcp --dport xxxx -j ACCEPT
# NAT Vz
$IPT -t nat -A POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j SNAT --to ip_serveur
# NAT SQL
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM2:22
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM2:80
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM2:443
#Base de donnée
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM2:3306
#NAT Mail
#SSH
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM3:22
#WEB
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM3:80
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM3:443
#Courrier
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM3:25
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM3:110
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM3:465
$IPT -t nat -A PREROUTING -i vmbr0 -p tcp --dport xxxx -j DNAT --to IP_VM3:993
# On "drop" tout le reste du traffic
$IPT -A INPUT -i eth0 -j DROP
return 0
}
Function that set the firewall rules
flush_rules()
{
$IPT -F INPUT
$IPT -F FORWARD
$IPT -F OUTPUT
return 0
}
command="$1"
case “$command” in
start|force-start|restart|force-restart|reload|force-reload)
flush_rules
set_rules
;;
stop)
flush_rules
;;
status)
$IPT -L
;;
*)
esac
[/code]
et enfin le fichier interfaces :
[code]# This file describes the network interfaces available on your system
and how to activate them. For more information, see interfaces(5).
The loopback network interface
auto lo
iface lo inet loopback
for Routing
auto vmbr1
iface vmbr1 inet manual
post-up /etc/pve/kvm-networking.sh
bridge_ports dummy0
bridge_stp off
bridge_fd 0
vmbr0: Bridging. Make sure to use only MAC adresses that were assigned to you.
auto vmbr0
iface vmbr0 inet static
address IP_serveur
netmask 255.255.255.0
network xxx.xxx.xxx.0
broadcast xxx.xxx.xxx.255
gateway xxx.xxx.xxx.254
bridge_ports eth0
bridge_stp off
bridge_fd 0
[/code]
Pour se qui est de l’install de l’adresse ip supplémentaire je n’ai rien configuré dans ce serveur, j’ai juste installé l’ip dans le container, c’est tout. J’ai fait excatement comme je t’ai déjà expliqué.
Ensuite, sur ma VM1, le ifconfig :
[code]lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4411 errors:0 dropped:0 overruns:0 frame:0
TX packets:4411 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1513253 (1.4 MiB) TX bytes:1513253 (1.4 MiB)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:24517 errors:0 dropped:0 overruns:0 frame:0
TX packets:22751 errors:0 dropped:47 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:14614223 (13.9 MiB) TX bytes:3621244 (3.4 MiB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:IP_supplémentaire P-t-P:IP_supplémentaire Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
[/code]
Pour le moment, pas de firewall dessus car dès que j’en mets un ça m’éjecte…
Le interfaces de la VM1 :
[code]# This configuration file is auto-generated.
WARNING: Do not edit this file, your changes will be lost.
Please create/edit /etc/network/interfaces.head and
/etc/network/interfaces.tail instead, their contents will be
inserted at the beginning and at the end of this file, respectively.
NOTE: it is NOT guaranteed that the contents of /etc/network/interfaces.tail
will be at the very end of this file.
Auto generated lo interface
auto lo
iface lo inet loopback
Auto generated venet0 interface
auto venet0
iface venet0 inet manual
up ifconfig venet0 up
up ifconfig venet0 127.0.0.2
up route add default dev venet0
down route del default dev venet0
down ifconfig venet0 down
iface venet0 inet6 manual
up route -A inet6 add default dev venet0
down route -A inet6 del default dev venet0
auto venet0:0
iface venet0:0 inet static
address IP_supplémentaire
netmask 255.255.255.255
[/code]
Pour cette machine, je n’ai pas et ne veux pas faire de bridge, il parait qu’au niveau sécurité c’est de la daube, et puis tout es lié dessus, le serveur sql et le serveur mail…
Alors biensur, je peux donner via le nat une ip réseau supplémentaire et ainsi accéder aux ports que je désire, mais ce n’est pas le but de la manoeuvre.
Ce que je veux, c’est, en tapant IP_supplémentaire:port que ça me dirige directement sur la machine qui a cette ip sur le port demandé !
Valaaa, je crois que je ne peux pas t’en dire plus…