CONFIGURATION RESEAU
DEBIAN Configuration Routage IPv4
script iproute2
#!/bin/bash`
ip link add link enp9s0.42 name tap42 type macvtap
ip tuntap add dev tap42 mode tap
...
ip link del tap42
/etc/network/interfaces https://lartc.org/howto/lartc.rpdb.multiple-links.html
source-directory /etc/network/interfaces.d
auto eth0
iface eth0 inet static
up echo "1" > /proc/sys/net/ipv4/ip_forward
up echo "1" > /proc/sys/net/ipv4/conf/all/proxy_arp
up echo "1" > /proc/sys/net/ipv6/conf/all/disable_ipv6
up /etc/network/iptables_config
address 192.168.1.1/24
gateway 192.168.1.254
dns-nameserver 127.0.0.1
dns-search michel-joly.fr
down iptables -F
auto eth0:netgear
iface eth0:netgear inet static
address 192.168.0.1/24
/etc/network/interfaces.d/vlan
auto eth0.42
iface eth0.42 inet static
vlan-raw-device eth0
address 192.168.42.254/24
dns-nameserver 127.0.0.1
dns-search michel-joly.fr
post-up restart isc-dhcp-server
user@host:$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether dc:a6:32:d9:50:97 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet 192.168.0.1/24 brd 192.168.0.255 scope global eth0:netgear
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether dc:a6:32:d9:50:98 brd ff:ff:ff:ff:ff:ff
4: eth0.42@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether dc:a6:32:d9:50:97 brd ff:ff:ff:ff:ff:ff
inet 192.168.42.254/24 brd 192.168.42.255 scope global eth0.42
valid_lft forever preferred_lft forever
ip ro
default via 192.168.1.254 dev eth0 onlink
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.1
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1
192.168.42.0/24 dev eth0.42 proto kernel scope link src 192.168.42.254
ip ro add default via {ip} dev {iface}
- default pour configurer la route par défaut, sinon préciser un réseau en notation CIDR
- {ip} est l'IP de la passerelle à emprunter
- {iface} est l'interface qui est configurée sur le même segment réseau que la passerelle
systemctl restart networking.service
journalctl -u networking.service -f
CentOS
/etc/sysconfig/network-scripts/ifcfg-{interface}
TYPE="ETHERNET"
BOOTPROTO="none"|"dhcp"
NAME="{nom_interface}"
DEVICE="{interface}"
ONBOOT="yes"
IPADDR={adresse_ip}
NETMASK={masque_reseau}
GATEWAY={passerelle}
Windows
Get-NetAdapter
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
Ethernet 3 Fortinet SSL VPN Virtual Ethernet Adap… 17 Not Present 00-09-0F-AA-00-01 0 bps
Ethernet 2 Fortinet Virtual Ethernet Adapter (NDI… 16 Disconnected 00-09-0F-FE-00-01 100 Mbps
Local Area Connection PPPoP WAN Adapter 14 Disconnected 00-00-00-00-00-00 0 bps
Ethernet 4 Intel(R) 82574L Gigabit Network Connec… 7 Up 52-54-00-3C-FC-79 1 Gbps
$(get\-netadapter | where {$_.status -match "disconnected"} | select ifindex).ifindex
14
16
$(get-netadapter | where status -match "disconnected" | select ifindex).ifindex
14
16
$(get-netadapter | where {$_.status -match "up"} | select ifindex).ifindex
7
new-netipaddress -interfaceindex {ifindex} -ipaddress {IP} -prefixlength {CIDR_mask} -defaultgateway {gw_IP}
set-dnsclientserveraddress -addresses {IP_DNS₁},{IP_DNS₂} -interfaceindex {ifindex}
Routage
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter
Cisco
> en
# conf t
#(conf) int {interface_a_configurer}
#(conf-if) ip address {adresse} {masque}
#(conf-if) no shut