Condense de commandes
#---
#--- dhclient - Dynamic Host Configuration Protocol Client
#---
linux@linux:~$ sudo dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0
#---
#----Affiche, configure une interface réseau------------------
#---
linux@linux:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 10:44:78:87:49:27
inet adr:192.168.0.5 Bcast:192.168.0.255 Masque:255.255.255.0
adr inet6: fe80::204:75ff:fe87:4927/64 Scope:Lien
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Packets reçus:13 erreurs:0 :0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reçus:2368 (2.3 KB) Octets transmis:5261 (5.2 KB)
Interruption:19 Adresse de base:0xac00
eth1 Link encap:Ethernet HWaddr 10:1b:21:3c:68:70
UP BROADCAST MULTICAST MTU:1500 Metric:1
Packets reçus:0 erreurs:0 :0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reçus:0 (0.0 B) Octets transmis:0 (0.0 B)
Interruption:20 Adresse de base:0xe800
lo Link encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
UP LOOPBACK RUNNING MTU:16436 Metric:1
Packets reçus:12 erreurs:0 :0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
Octets reçus:720 (720.0 B) Octets transmis:720 (720.0 B)
#--
#----------------------------------------------------
#--
linux@linux:~/Commandes$ route -ne
Table de routage IP du noyau
Destination Passerelle Genmask Indic MSS Fenêtre irtt Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.0.254 0.0.0.0 UG 0 0 0 eth0
linux@linux:~/Commandes$ route -e
Table de routage IP du noyau
Destination Passerelle Genmask Indic MSS Fenêtre irtt Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
default 192.168.0.254 0.0.0.0 UG 0 0 0 eth0
#--
#----------------------------------------------------
#--
sudo ifconfig etho down
sudo ifconfig eth0 down
sudo /etc/init.d/networking force-reload
ifconfig
sudo lshw -C network -numeric
ifconfig
route -n
ifconfig
#--
#----------------------------------------------------
#--
sudo ifconfig
sudo ifconfig eth0 down
sudo ifconfig eth0 up
#--
#----------------------------------------------------
#--
pg /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet dhcp
#--
#----------------------------------------------------
#--
/etc/sysctl.d/10-network-security.conf
#--
#----------------------------------------------------
#--
iwconfig
#--
#----------------------------------------------------
#--
cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 212.27.40.240
nameserver 212.27.40.241
#--
#----------------------------------------------------
#--
route -n
Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
#--
#----------------------------------------------------
#--
pg /etc/udev/rules.d/70-persistent-net.rules
# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.
# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:19:21:3c:86:60", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10b7:0x9200 (3c59x)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:04:75:87:49:27", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
#--
#----------------------------------------------------
#--
linux@linux:~/Commandes$ pg /etc/dhcp3/dhclient.conf
# Configuration file for /sbin/dhclient, which is included in Debian's
# dhcp3-client package.
#
#------------- Ajout Linux avant en commentaire
alias {
interface "eth0";
fixed-address 192.168.0.5;
option subnet-mask 255.255.255.0;
}
#--
#-------------------------------------------------------------
#--
linux@linux:~/Commandes$ sudo depmod -a
linux@linux:~/Commandes$ sudo ls -ltr /lib/modules/2.6.32-24-generic/modules*
-rw-r--r-- 1 root root 104529 2010-08-20 20:22 /lib/modules/2.6.32-24-generic/modules.order
-rw-r--r-- 1 root root 5084 2010-08-20 20:22 /lib/modules/2.6.32-24-generic/modules.builtin
-rw-r--r-- 1 root root 839848 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.usbmap
-rw-r--r-- 1 root root 295361 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.symbols.bin
-rw-r--r-- 1 root root 228851 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.symbols
-rw-r--r-- 1 root root 1597 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.seriomap
-rw-r--r-- 1 root root 403957 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.pcimap
-rw-r--r-- 1 root root 74 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.ofmap
-rw-r--r-- 1 root root 24886 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.isapnpmap
-rw-r--r-- 1 root root 218 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.inputmap
-rw-r--r-- 1 root root 1405 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.ieee1394map
-rw-r--r-- 1 root root 397652 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.dep.bin
-rw-r--r-- 1 root root 269549 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.dep
-rw-r--r-- 1 root root 69 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.ccwmap
-rw-r--r-- 1 root root 6363 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.builtin.bin
-rw-r--r-- 1 root root 569737 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.alias.bin
-rw-r--r-- 1 root root 590022 2012-10-07 07:09 /lib/modules/2.6.32-24-generic/modules.alias
#--
#---show / manipulate routing, devices, policy routing and tunnels
#--
linux@linux:~/Commandes$ sudo ip addr show eth0
3: eth0: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:04:75:87:49:27 brd ff:ff:ff:ff:ff:ff
inet6 fe80::204:75ff:fe87:4927/64 scope link
valid_lft forever preferred_lft forever
##find and kill any dhcp clients looking on eth.
sudo ip a flush dev eth0
##then add your address info
sudo ip a a dev eth0 192.168.0.1/5
##route show
sudo ip route show
#--
#--------------------------------------------
#--
linux@linux:~$ pg /etc/sysctl.d/10-network-security.conf
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks.
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1
# Turn on SYN-flood protections. Starting with 2.6.26, there is no loss
# of TCP functionality/features under normal conditions. When flood
# protections kick in under high unanswered-SYN load, the system
# should remain more stable, with a trade off of some loss of TCP
# functionality/features (e.g. TCP Window scaling).
net.ipv4.tcp_syncookies=1
#---- ajout
net.ipv6.binv6only=0
#--
#--view, manipulate media-independent interface status
#--
sudo mii-tool
#--
#-- Renouveler bail DHCP
#--
## ipconfig /renew
## Sous Linux la commande ifconfig
## Mais pour le renew il faut utiliser dhclient
## Liberer l’adresse IP courante
sudo dhclient -r
## recuperer une nouvelle adresse IP ou la même
sudo dhclient
#--
#-- start Activez les connexions réseaux en bash
#--
#!/bin/sh
#
#
#-------if SAMSUNG_Android is connected #
## SAMSUNG_Android=$(systemctl| grep SAMSUNG_Android |grep sys-subsystem | tee $$ 1>/dev/null&& cut -d'-' -f5 $$ | cut -d'.' -f1)
## if test -s $$
## then
## sudo /usr/bin/dhcpcd -x ${SAMSUNG_Android}
## sudo /usr/bin/dhcpcd ${SAMSUNG_Android} -f /etc/dhcpcd.conf_SAMSUNG_Android
## rm $$
## ifconfig -a
## exit
## fi
## rm $$
#
sudo ln -fs /etc/dhcpcd.conf_enp2s0 /etc/dhcpcd.conf
sudo ip link set dev enp2s0 down
sleep 2
sudo ip link set dev enp2s0 up
sleep 2
for carte in $(ifconfig | grep flags | cut -d: -f1| egrep -v "enp2s0|lo" )
do
#test $(systemctl| grep SAMSUNG_Android | echo $? ) -ne 0 && sudo ln -fs /etc/dhcpcd.conf_SAMSUNG_Android /etc/dhcpcd.conf
sudo ip link set dev enp2s0 down
sleep 2
sudo ln -fs /etc/dhcpcd.conf_${carte} /etc/dhcpcd.conf
done
#sudo /usr/bin/dhcpcd -x /etc/dhcpcd.conf
#sudo /usr/bin/dhcpcd /etc/dhcpcd.conf -f /etc/dhcpcd.conf
sudo /usr/bin/dhcpcd -x
sleep 1
sudo /usr/bin/dhcpcd
sleep 1
#sudo netstat -plantu
sudo netstat -r
echo
sudo netstat -i
echo
sleep 1
ifconfig | grep -w "inet 192"
echo
ls -ld /etc/dhcpcd.conf
echo
exit
#
#----- enp2s0 carte interne #
#sudo ifconfig enp2s0 up
sudo ip link set dev enp2s0 down
sleep 2
sudo ip link set dev enp2s0 up
sleep 2
sudo /usr/bin/dhcpcd -x
sleep 1
#sudo rm /var/lib/dhcpcd/dhcpcd-enp2s0.lease
#sleep 1
sudo /usr/bin/dhcpcd
#sudo /usr/bin/dhcpcd -z enp2s0 --ipv4only -t 0
#sudo /usr/bin/dhcpcd -z enp2s0 -E
#sudo /usr/bin/dhcpcd -r 192.168.0.1
#sudo netstat -plantu
sudo netstat -r
sudo netstat -i
sleep 1
ifconfig | grep -w "inet 192"
exit
ip link set dev enp2s0 up
ip addr add dev enp2s0 broadcast 192.168.0.255 local 192.168.0.4
ip route add default via 192.168.0.4 dev enp2s0
sudo dhcpcd -S ip_address=192.168.0.4 \
-S routers=192.168.0.254 \
-S domain_name_servers=212.27.40.240 \
enp2s0
sudo ifconfig -v enp2s0 192.168.0.4
sudo rm -v /run/dhcpcd-enp2s*
#sudo /usr/bin/dhcpcd -x
sudo systemctl status dhcpcd@enp2s0.service
sudo systemctl stop dhcpcd@enp2s0.service
sudo systemctl start dhcpcd@enp2s0.service
exit
root 330 1 0 11:24 ? 00:00:00 /usr/bin/dhcpcd -q -b
root 355 1 0 11:24 ? 00:00:00 /usr/bin/dhcpcd -q -w enp2s0
user 566 439 0 11:26 pts/0 00:00:00 grep dhcp
dhcpcd -k
dhcpcd
[18:19:28 user@archtux ~]$ cat /etc/dhcpcd.
dhcpcd.conf dhcpcd.duid
/etc/dhcpcd.conf
static ip_address=192.168.0.3
[18:19:28 user@archtux ~]$ cat /etc/dhcpcd.duid
00:01:00:01:1d:17:20:3e:d4:3d:7e:df:80:b9
#
# /etc/dhcpcd.conf_SAMSUNG_Android
#
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
#
# define static profile
## profile static_eth0
# profile static_enp2s0
#static ip_address=192.168.0.3
#static routers=192.168.0.254
#static domain_name_servers=212.27.40.240
#static domain_name_servers=212.27.40.241
# dns google
#static domain_name_servers=8.8.4.4
#static domain_name_servers=8.8.8.8
##
## # fallback to static profile on eth0
interface enp0s20u7
#interface enp0s2
#fallback static_enp2s0
#define static profile
#profile static_enp2s0
#static ip_address=192.168.0.1
#static routers=192.168.0.254
#static domain_name_servers=212.27.40.240
#static domain_name_servers=212.27.40.241
# Inform the DHCP server of our hostname for DDNS.
hostname
#nohook resolv.conf
# Use the hardware address of the interface for the Client ID (DHCPv4).
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
#Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
#nohook lookup-hostname
#noipv4
noipv6rs
noipv6
#Speed up DHCP by disabling ARP probing
noarp
#
# /etc/resolv.conf
#
nameserver 212.27.40.240
nameserver 212.27.40.241