this is the basic knowledge of computer networking
Computer networking is an engineering discipline that aims to study and analyze the communication process among various computing devices or computer systems that are linked, or networked, together to exchange information and share resources.
Computer networking depends on the theoretical application and practical implementation of fields like computer engineering, computer sciences, information technology and telecommunication.
Reach / Size
- LAN (Local Area Network) 局域网
- MAN (Metropolitan Area Network) 城域网
- WAN (Wide Area Network) 广域网 eg: "Internet"
- PC
- Server
- Printer
- routers(路由器)
- modem(调制解调器)
- ...
PC --- Server --- Laptop
“client” "Host"
P.C. ————————— Web Server
A Network Interface Card (NIC) is a computer hardware component that allows a computer to
connect to a network. NICs may be used for both wired and wireless connections.
A NIC is also known as a network interface controller (NIC), network interface controller
card, expansion card, computer circuit board, network card, LAN card, network adapter or
network adapter card (NAC).
A protocol is a set of rules and guidelines for communicating data. Rules are defined for each step and process during communication between two or more computers. Networks have to follow these rules to successfully transmit data.
http://www.google.com/index.html
http: protocol
www.google.com: server name
index.html: file
Bus topology is a specific kind of network topology in which all of the various devices in the network are connected to a single cable or line. In general, the term refers to how various devices are set up in a network.
"BUS":
"PC" "MAC"
"T" ------------------------------ "Terminal"
"Laptop"
A ring topology is a network configuration in which device connections create a circular data path. Each networked device is connected to two others, like points on a circle. Together, devices in a ring topology are referred to as a ring network.
Alternatively referred to as a star network, star topology is one of the most common network setups. In this configuration, every node connects to a central network device, like a hub, switch, or computer. The central network device acts as a server and the peripheral devices act as clients. Depending on the type of network card used in each computer of the star topology, a coaxial cable or an RJ-45 network cable is used to connect computers together.
A network setup where each computer and network device is interconnected with one another, allowing for most transmissions to be distributed even if one of the connections go down. It is a topology commonly used for wireless networks. Below is a visual example of a simple computer setup on a network using a mesh topology.
- Applications (firefox / chrome / email)
- Presentation (O.S. / letters # numberts --> ASCII)
- Session (Conversion between 2 computers)
- Transport (packages/datas are dilivered reliably)
- Network (Determine best roure for data)
- Data Link (NIC's / checking for error)
- Physical (Cable / fiber-optics / Electric Signals)
It gives us more ports.
A repeater is a network device that retransmits a received signal with more power and to an extended geographical or topological network boundary than what would be capable with the original signal.
0 ~ 255
128 64 32 16 8 4 2 1 0
8-bit. 256 values
2^8. = 256
2^32 = .....
108 . 161 . 228 . 70
01101100 10100001 11100100 01000110
108 . 161 . 228 . 70
01101100 10100001 11100100 01000110
108.161 : host
228.70 : can connect to
so? How IP address save the world?
108 . 161 . 228 . 70
IP Address 01101100 10100001 11100100 01000110
Subnet mask 11111111 11111111 11111111 00000000 (255.255.255.0)
IP 169.174.141.10
Subnet 255.255.255.240
IP Address: 10101001 10101110 10001101 00001010
Subnet mask: 11111111 11111111 11111111 11110000
--------------------------------------------------
Network ID: 10101001 10101110 10001101 00000000
Network IP: 169. 174. 141. 0
Numbers if hosts: 16 (2^4, Subnetm mask have 4 zero)
Numbers if udsble hosts: 14
Usable hosts. 169.174.141.1 - 169.174.141.14 (belongs to us)
- Google Cloud
- Amazon
- digitalocean
$ ssh user@ip_address -p 22
$ sudo nano /etc/ssh/sshd_config
Port 22 ---> Port 7777
$ sudo service ssh restart
$ sudo ufw allow 22/tcp # 开放 ssh
$ sudo ufw allow 80/tcp # 开放 http
$ sudo ufw allow 443/tcp # 开放 https
$ sudo ufw show added # to check
$ sudo ufw enable # to enable, maybe should choice timezone
$ sudo apt-get update
$ sudo apt-get apache2
$ sudo apt-get install mysql-server php5-mysql # php5-mysql only for php
$ sudo mysql_secure_installation
$ sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
$ sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi ......
</IfModule>
$ sudo server apache2 restart
$ apt-cache search php5-
$ apt-cache show php5-json
$ sudo apt-get install php5-json
$ sudo nano /var/www/html/index.php
<?php
echo("Hey baby!");
?>
$ sudo nano /var/www/html/info.php
<?php
phpinfo();
?>
$ sudo apt-get install phpmyadmin # should config by step
$ sudo php5enmod mcrypt
$ sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
$ sudo server apache2 restart
$ sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf
<Directory /usr/share/phpmyadmin>
.....
AllowOverride All
<Directory>
$ sudo server apache2 restart
$ sudo nano /usr/share/phpmyadmin/.htaccess
AuthTuype Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htaccess
Require valid-user
$ sudo apt-get install apache2-utils
$ sudo htpasswd -c /etc/phpmyadmin/.htpasswd shiinlee # then to config password
wikipedia: DHCP
-
information
-
releasing
wikipedia: DNS
$ route
$ 54.123.2.2
Destination Gateway Genmask Flags Mettric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 1024 0 0 eth0
192.168.0.0 * 255.255.255.0 U 0 0 0 wlan0
$ iptables -L # list iptables
Chain INPUT ......
Chain FORWARD .....
$ iptables -P FORWARD DROP # this is to change `FORWARD` pocicy to DROP
$ iptables -L
$ iptables -A INPUT -s 192.168.0.23 -j DROP # this is to block the 192.168.0.23, it can't connect my computer anymore
$ iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP # DROP the 192.168.0.0/24 tcp connection of smtp(mail)
$ iptables -A INPUT -s 192.168.66 -j ACCEPT # this like white list
$ iptables -D INPUT 3 # delete the third one
$ iptables -I INPUT -s 192.168.66 -j ACCEPT # -I, add it to the top of the list