[memo] 設定 Ubuntu 固定 IP/ How to Configure Static IP Address on Ubuntu Server/Desktop

手動改 : sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0

在 /etc/netplan/00-installer-config.yaml
用 DHCP 取 IP

# more 00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s3:
      dhcp4: true
  version: 2

增加 /etc/netplan/01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      addresses:
        - 192.168.100.33/24
      gateway4: 192.168.100.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

需 rm /etc/netplan/00-installer-config.yaml
免得跟原來的config衝突,
再執行

sudo netplan apply

 


OVH:

Some sample …

for office lan

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: no
      addresses:
        - 192.168.1.11/24
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

[memo] Ubuntu : ctrl-L not work , 按 ctrl-L 不會清除螢幕 , TERM , .bashrc .profile 問題 , Ubuntu 8.04.4 LTS

這個版本的 .bashrc 不 work , 要用 .profile
lsb_release  -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04.4 LTS
Release: 8.04
Codename: hardy
—-
$ cat .profile
export EDITOR=vi
export PATH=/sbin:$PATH
export LANG=
export TERM=xterm
export http_proxy=
export https_proxy=

Use dd command to backup whole disk to image file , acer desktop , win7 , pv(pipe viewer example)

Acer ASPIRE M1930 partition layout

Same PC but install windows7

 

-- OK! 在 virtualbox 測試
dd if=/dev/sda | pv | ssh -p 2200 [email protected] 'cat > winxp2.dd.img'
ssh -p 2200 [email protected] 'cat winxp2.dd.img' | pv | dd of=/dev/sda

-- OK! 把 Acer PC 整個硬碟備份到遠端 server 的 image file
dd if=/dev/sda | pv | ssh -p 2200 [email protected] 'cat > /mnt/m1/acer-pc-win7.dd.img'

-- OK!把 Acer PC 改裝 windows7 後, 備份到遠端 server
-- 用 pv 看進度 , pipe 給 gzip 壓縮後再透過 ssh 傳到遠端 server ,
dd if=/dev/sda | pv | gzip | ssh -p 2200 [email protected] 'cat > /mnt/m1/desktop-win7.dd.img.gz'

976773168+0 records in
976773168+0 records out
500107862016 bytes (500 GB, 466 GiB) copied, 12321.3 s, 40.6 MB/s

94G     desktop-win7.dd.img.gz