« Paramétrer OpenWRT sur PI3 (ou autre) » : différence entre les versions

De Wiki de Mémoire Vive
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 11 : Ligne 11 :
<pre>
<pre>
uci set network.lan.ipaddr='192.168.1.xx' # choisir xx
uci set network.lan.ipaddr='192.168.1.xx' # choisir xx
uci set network.lan.netmask='255.255.255.0'
uci set network.lan.gateway='192.168.1.1'  # Facultatif, à définir si besoin
uci set network.lan.dns='8.8.8.8 1.1.1.1'  # Facultatif, pour configurer les DNS
uci commit network
uci commit network


Ligne 23 : Ligne 20 :


</pre>
</pre>
A noter : si on s'en tient à ces modifications, c'est le DHCP de la box qui est utilisé. Si on désactive ce dernier la connexion internet ne fonctionne pas.


Une fois les modifs réseau effectuées, on peut accéder à l'interface web de OpenWRT avec l'adresse choisie, pas de mot de passe.
Une fois les modifs réseau effectuées, on peut accéder à l'interface web de OpenWRT avec l'adresse choisie, pas de mot de passe.

Version du 1 avril 2025 à 10:33

OpenWRT s'installe sur un pI3

Cette vidéo est pas mal, https://youtu.be/QGdLMPTz9N8?si=azFIbd36R1-CbEoQ

Telecharger l'image depuis https://openwrt.org pour le matériel concerné, puis graver l'image et démarrer le PI3.

Ensuite il y a un paramétrage à faire pour choisir le bon paramétrage réseau.

Commande à taper après démarrage pour modifier l'adresse IP du routeur :

uci set network.lan.ipaddr='192.168.1.xx' # choisir xx
uci commit network

/etc/init.d/network restart

ip a pour vérifier

le contenu modifié est dans /etc/config/network

Une fois les modifs réseau effectuées, on peut accéder à l'interface web de OpenWRT avec l'adresse choisie, pas de mot de passe.

Configuration complète

1) fichier /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd51:61bb:5f05::/48'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.2'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option gateway '192.168.1.1'
        option dns '8.8.8.8'

config interface 'WIFI'
        option proto 'static'
        option ipaddr '192.168.3.1'
        option netmask '255.255.255.0'
        list dns '8.8.8.8'

config route
        option interface 'WIFI'
        option gateway '192.168.1.1'
        option target '0.0.0.0/0'
        option disabled '1'

config interface 'wg0'
        option proto 'wireguard'
        option private_key '2LLlE0/mmHm6jwlGWZLQ6l6XZTURkSw/tZLXhFGdPF0='
        option listen_port '51829'
        list addresses '172.16.1.1/24'
        list dns '8.8.8.8'

config wireguard_wg0
        option public_key 'dqVYOYJzf0oyPvzYHgiLh3FrgUhh2TK4WtUxH6JQnWk='
        option route_allowed_ips '1'
        option persistent_keepalive '25'
        option private_key '0O3mF8sonG8Nf1mosL7c5jWhLAIRCEZhc5RzriQDFn0='
        list allowed_ips '172.16.1.2/32'
        option description 'tel Denis'

config route
        option interface 'WIFI'
        option target '192.168.1.0/24'
        option gateway '172.16.1.1'

2) fichier /etc/config/firewall

config defaults
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option synflood_protect '1'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option masq '1'
        list network 'lan'

config zone
        option name 'wifi'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option masq '1'
        list network 'WIFI'

config forwarding
        option src 'wifi'
        option dest 'lan'

config forwarding
        option src 'lan'
        option dest 'wifi'

config zone
        option name 'wg'
        option network 'wg0'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option masq '1'
        option mtu_fix '1'

config rule
        option name 'Allow-WireGuard-To-LAN'
        option src 'wg'
        option dest 'lan'
        option proto 'all'
        option target 'ACCEPT'

config forwarding
        option src 'wg'
        option dest 'wifi'

config forwarding
        option src 'wifi'
        option dest 'wg'