aboutsummaryrefslogtreecommitdiff
path: root/source/notes/2016-12-13-nat.md
blob: ec84b51b13c4a420b683eda4e936d46f4408f512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
title: "nat"
date:  2016-12-13T09:14:00
date_display: Dec 13, 2016
---

Mise en place du NAT sur archlinux :


```sh
# ip link set up dev net0
# ip addr add 192.168.123.100/24 dev net0
# sysctl net.ipv4.ip_forward=1
# iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE
# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i net0 -o internet0 -j ACCEPT
```

Mise en place d'une ip fixe sur debian :
```sh
# ifconfig eth0   192.168.123.101 netmask 255.255.255.0
# route add default gw 192.168.123.100 eth0
```

Pour éviter tout conflit (genre config par défault qui viens péter tout la conf)
j'ai du désactiver le service networkmanager. (Ce qui ma fait tilter : 
[https://bbs.archlinux.org/viewtopic.php?id=207597](https://bbs.archlinux.org/viewtopic.php?id=207597)

Sources : 

- [https://wiki.archlinux.org/index.php/Internet_sharing](https://wiki.archlinux.org/index.php/Internet_sharing)

- [http://www.howtogeek.com/118337/stupid-geek-tricks-change-your-ip-address-from-the-command-line-in-linux/](http://www.howtogeek.com/118337/stupid-geek-tricks-change-your-ip-address-from-the-command-line-in-linux/)