Administration système et réseau |
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk |-sda1 8:1 0 1K 0 part |-sda3 8:3 0 100M 0 part `-sda4 8:4 0 229.1G 0 part sdb 8:16 0 29.8G 0 disk `-sdb1 8:17 0 29.8G 0 part sr0 11:0 1 1024M 0 rom # mount -t vfat /dev/sdb1 /mnt
# mount -o uid=pifou,gid=pifou /dev/sdb1 /mnt # mount -o loop /usr/local/xen/domains/virtual/disk.img /mnt
root@machine:/mnt# cd root@machine:/# umount /mnt
# The loopback network interface auto lo iface lo inet loopback # The primary network interface (IPv4) iface eth0 inet dhcp # A secondary network interface (IPv4) iface eth1 inet static address 172.26.79.42 netmask 255.255.240.0 # gateway 172.26.79.254 # The wifi network interface (WPA/IPv4) auto wlan0 iface wlan0 inet static wpa-ssid SWEETHOME wpa-key-mgmt WPA-PSK wpa-psk cpasbeaudetresicurieux address 192.168.0.10 netmask 255.255.255.0 gateway 192.168.0.254
nameserver 193.58.57.34
server$ ssh admin@router Password: router>enable Password: router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#exit router#write Building configuration... [OK] router#reload Proceed with reload? [confirm]
router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#enable password glopglop router(config)#! ou pour plus de sécurité : router(config)#enable secret glopglop router(config)#line vty 0 15 router(config-line)#password glopglop router(config-line)#exit
router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#hostname router router(config)#aaa new-model router(config)#username admin privilege 15 password glopglop router(config)#! ou pour plus de sécurité : router(config)#username admin privilege 15 secret glopglop router(config)#ip domain-name deule.net router(config)#crypto key generate rsa router(config)#line vty 0 15 router(config-line)#transport input ssh router(config-line)#exit
router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#interface GigabitEthernet0/1 router(config-if)#ip address 192.168.0.1 255.255.255.0 router(config-if)#exit router(config)#exit
router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#ip routing router(config)#exit router#show ip route
router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#interface GigabitEthernet0/1.2 router(config-subif)#encapsulation dot1Q 2 router(config-subif)#ip address 192.168.2.1 255.255.255.0 router(config-subif)#exit router(config)#exit
router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#interface vlan2 router(config-if)#ip address 192.168.2.1 255.255.255.0 router(config-if)#exit router(config)#exit
switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. switch(config)#interface gigabitEthernet0/7 switch(config-if)#switchport switch(config-if)#switchport mode access switch(config-if)#switchport access vlan 2 switch(config-if)#exit
switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. switch(config)#interface fastEthernet0/1 switch(config-if)#switchport switch(config-if)#! erreur si pas d'autre encapsulation connue switch(config-if)#switchport trunk encapsulation dot1q switch(config-if)#switchport mode trunk switch(config-if)#exit
<VirtualHost *:80> ServerName monsite.mondomaine.org ServerAdmin moncourriel@mondomaine.org Options Indexes FollowSymLinks DocumentRoot /var/www/html/monsite/ ... </VirtualHost>
<VirtualHost *:443> ... SSLEngine on SSLCertificateFile /etc/ssl/certs/monsite.pem SSLCertificateKeyFile /etc/ssl/private/monsite.pem ... </VirtualHost>
ProxyPass / http://192.168.0.42/ ProxyPassReverse / http://192.168.0.42/ ProxyRequests Off
echo "proc /proc proc defaults 0 0" >> rootfs/etc/fstab
# mkdir /sys/fs/cgroup/cpuset/model1 # echo "2-3" > /sys/fs/cgroup/cpuset/model1/cpus # echo $pid > /sys/fs/cgroup/cpuset/model1/tasks
# mkdir /sys/fs/cgroup/memory/model1 # echo "128M" > /sys/fs/cgroup/memory/model1/memory.limit_in_bytes # echo $pid > /sys/fs/cgroup/memory/model1/tasks
# mkdir /sys/fs/cgroup/blkio/model1 # echo "8:0 10485760" > /sys/fs/cgroup/blkio/model1/blkio.throttle.write_bps_device # echo $pid > /sys/fs/cgroup/blkio/model1/tasks
# mkdir /sys/fs/cgroup/devices/model1 # echo "b 8:0 rmw" > /sys/fs/cgroup/devices/model1/devices.deny # echo $pid > /sys/fs/cgroup/devices/model1/tasks
ip link add monpont type bridge
ip link set eth0 master monpont ip link set eth1 master monpont
ip link set eth0 up ip link set eth1 up
ip address add dev monpont 192.168.0.1/24
auto eth0 eth1 monpont iface eth0 inet manual up ip link set $IFACE up iface eth1 inet manual up ip link set $IFACE up iface monpont inet static bridge_ports eth0 eth1 address 192.168.0.1 netmask 255.255.255.0
ip link add vif1 type veth peer name eth0@vif1
ip link set eth0@vif1 netns /proc/PID/ns/net name eth0
nsenter -t PID -n ip address add dev eth0 192.168.0.100/24 nsenter -t PID -n ip route add default gw 192.168.0.1
# docker images REPOSITORY TAG IMAGE ID CREATED SIZE debian jessie e5599115b6a6 4 weeks ago 123 MB .... # docker tag e5599115b6a6 docker.mondomaine.org:5000/my-debian # docker push docker.mondomaine.org:5000/my-debian
# cat Dockerfile FROM debian MAINTAINER Moi RUN apt-get update RUN apt-get -y install apache2 EXPOSE 80 CMD /usr/sbin/apache2ctl -D FOREGROUND # docker build -t apache .
# docker commit 814b74435ace sha256:ea17999b6621fcb62b4999fbd0e23e54aef72a9418c4d0d37d411c8737bd4f8d # docker images ... # docker tag ea17999b6621 docker.mondomaine.org:5000/my-apache # docker push docker.mondomaine.org:5000/my-apache
# docker run --privileged -i -t debian /bin/bash
# docker run --cpus=0.5 -i -t debian /bin/bash # docker run --cpu-count=2 -i -t debian /bin/bash
# docker run --memory=128m --memory-swap=256m -i -t debian /bin/bash
# docker run --device-write-bps=/dev/sda:10mb -i -t debian /bin/bash
# # rwm -> read, write and mknod # docker run --device=/dev/sdb:rwm -i -t debian /bin/bash
# man docker run
# docker networks ls NETWORK ID NAME DRIVER SCOPE 422a25c7e8cf bridge bridge local 3e0f696af22b host host local b00b2e188cb6 none null local
# docker network create mybridge
# docker run -i --net=mybridge -t my-apache /bin/bash
# docker network connect bridge 9ae343fe5609
# docker run -i -p 80:80 -t my-apache /bin/bash
# pvcreate /dev/sda5 # pvcreate /dev/sdb
# vgcreate volume /dev/sda5 /dev/sdb # vgdisplay
# lvcreate -L4G -nroot volume # lvcreate -L16G -nvar volume # lvcreate -L2G -ntmp volume
# pvcreate /dev/sdc # vgextend volume /dev/sdc # lvextend -L+1G /dev/volume/root # resize2fs /dev/volume/root
# pvmove /dev/sda5 /dev/sdc # vgreduce volume /dev/sda5
qemu-img create <chemin du disque> <taille>
kvm -net nic,model=ne2k_pci -net user -hda <chemin du disque> -cdrom <chemin de l'image ISO>
kernel = '/usr/lib/xen-default/boot/hvmloader' builder = 'hvm' memory = '1024' disk = [ 'file:/usr/local/src/debian-testing-i386-netinst.iso,hdc:cdrom,r', 'file:/usr/local/xen/domains/simplet/simplet_disk.img,ioemu:sda,w', ] boot = 'd' name = 'scratch' vif = [ 'bridge=eth1' ] vnc = 1 vnclisten = "0.0.0.0"
... (network-script 'network-bridge netdev=eth0') ...
kernel = '/boot/vmlinuz-2.6.32-5-xen-686' ramdisk = '/boot/initrd.img-2.6.32-5-xen-686' memory = '1024' root = '/dev/xvda1 ro' disk = [ 'file:/usr/local1/xen/domains/fourmies/fourmies_root.img,xvda1,w', 'file:/usr/local1/xen/domains/fourmies/fourmies_swap.img,xvda2,w', 'file:/usr/local1/xen/domains/fourmies/fourmies_tmp.img,xvda5,w', 'file:/usr/local1/xen/domains/fourmies/fourmies_var.img,xvda6,w', 'file:/usr/local1/xen/domains/fourmies/fourmies_home.img,xvda7,w', 'file:/usr/local1/xen/domains/fourmies/fourmies_log.img,xvda8,w', 'phy:/dev/spool1/mail-spool,xvdb1,w', 'phy:/dev/spool2/mail-backup,xvdc1,w' ] name = 'fourmies' dhcp = 'dhcp' vif = [ 'mac=00:16:3E:52:80:93, bridge=bridge2' ] on_poweroff = 'destroy' on_reboot = 'restart' on_crash = 'restart'
xm list xm create fourmies.cfg xm console fourmies xm shutdown fourmies ...
Ce document a été traduit de LATEX par HEVEA