You are on page 1of 11

Interfata Wif sau Ethernet - merge

1) Daca vreau Wifi pun dongle Wifi on USB si scot Ethernet.


2) Daca vreau Ethernet la PC, scut USB dongle si pun cablul la PC.
3) Am deconectat de la calculator
4) Am alimentat din Power bank. De pus un cablu mai bun la alimentare la
Power bank
5) A pornit
6) Am introdus Wifi
7) Ip a-
8) Iwconfig
9) Sudo Ip link set wlan0 up
10) Sudo iwlist scan. Am aflat telefonul care avea Wifi activat.
11) Interfata grafica nu este KDE sai GNOME, asa ca am configurat
wpasupplicant
12) Sudo wpa_passphrase Lenovo a806 >
/etc/wpa_supplicant/wpa_supplicant.conf. Am introdus parola 8e1a061405e2
13) Asa a scris in wpasupplicant, inclusive psk.
14) Sudo wpa_supplicant D nl80211 I wlan0 c
/etc/wpa_supplicant/wpa_supplicant.conf B
15) sudo dhclient wlan0
16) ping www.google.com
17) Sudo nano /etc/network/interfaces
a. Am schimbat iface wlan0 inet dhcp
b. Si in fata am adaugat auto wlan0
18) Sudo shutdown
19) Am obtinut inet 192.168.43.49/24 brd 192.168.43.255
a. Valid-lft forewer preffered_lft forewer
b. Mac 8A:70:8C:95:93:F$ master
20) Iwconfig arata power management off. Altfel se poate ca legatura sa se
intrerupa la inactivitate.
Cateodata la pepornirea Raspberry Pi reteaua este automata, poate ca era activat
Wifi de la telefon.
Ca sa o repornesc cred ca merge
1) Sudo wpa_supplicant D nl80211 I wlan0 c
/etc/wpa_supplicant/wpa_supplicant.conf B
2) sudo dhclient wlan0
3) ping www.google.com
Am observ at ca deoarece wlan0 porneste automat, nu mai pot sa il leg la PC prin
eth0. De aceea
auto eth0 porneste interfata la boot
auto-hotpluf eth0 porneste cand se conecteaza fizic la ea
iface eth0 inet
Obligatoriu trebuie sa am pus cablul de internet la bootarea Raspberry Pi.
Stadiul actual:
1) daca am introdus wifi dongle, porneste automat internetul
2) daca scot dongle si redau
a. Sudo wpa_supplicant D nl80211 I wlan0 c
/etc/wpa_supplicant/wpa_supplicant.conf B
b. sudo dhclient wlan0
c. ping www.google.com
3) Merge.
4) Daca am scos wifi si am pus cablul la pornire, pot ca sa ma loghez de pe PC
5) Daca scot cablul si il repun nu merge
6) Daca lucrez direct pe Raspberry Pi, si fara wifi dongle, nu remote, pot da sudo
dhclient eth0 ca sa am internet prin cablul de internet.
7) Dar nu mai pot lucra remote prin pc ca spune nu route to host.
8) Ce am facut:
a. Lucru direct pe Pi
i. sudo ip link set eth0 up
ii. sudo dhclient etho
iii. dj merge de pe Pi.
b. Pe PC
i. Din setarile ruterului quick setup
ii. Din linia de comanda ping 192.168.1.101
iii. Conectare cu putty
iv. Merge
9) Cred ca este ca am iesit din legatura fara logout.
10) Cand parasesc putty, dau comanda logout.
11) Cred c ar fi util s am schimbat iface wlan0 inet static, iface eth0 inet
static pentru ca s m conectez totdeauna la acelai server fr s mai caut
s mi se aloce cu dhclient un IP.
https://wiki.debian.org/NetworkConfiguration
auto eth0 porneste interfata la boot
auto-hotpluf eth0 porneste cand se conecteaza fizic la ea
http://unix.stackexchange.com/questions/128439/good-detailed-explanation-of-etc-
network-interfaces-syntax
iface eth0 inet static ii dau ipul
manual il ia el
Mai jos este un capitol pentru autoconfgurarea reelei la
introducerea cablului de Ethernet sau a stick-ului Wif.
Este preferabil s lucrez cu adrese de IP statice pentru a face un server care
acceseaz internetul.
Using DHCP to automatically confgure the interface

If you're just using DHCP then all you need is something like:

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

If you're configuring it manually then something like this will set the default gateway (network,
broadcast and gateway are optional):
auto eth0
iface eth0 inet static
address 192.0.2.7
netmask 255.255.255.0
gateway 192.0.2.254

Configurare adres static


Sudo nano interfaces

Iface eth0 inet static


Address 192.168.0.210
Netmask 255.255.255.0
Network 255.255.0.0
Gateway 192.168.0.101
Sudo reboot
Sudo ifconfig eth0 down
Nameserver 8,8,8,8
Nameserver 8.8.4.4
Sudo/etc/resolv.conf
Inauntru este
Nameserver 192.168.0.101
Adaug in fata
nameserver 8.8.8.8
nameserver 8.8.4.4
Ies si dau
Cd /etc
Sudo route add default gw 192.168.0.101 eth0
Route
Sudo nano hostname
A adaugat la fisierul interfaces liniile wpa
SUDO REBOOT
Apoi a modificat si wlan ca static

Reboot
Sudo ifconfig eth0 down
sudo ifconfig eth0 up
Asignare adres static la adaptorul WiFi: sudo ifconfig wlan0
192.168.42.1
IP static altfel, parca mai clar. Setez eu ce adres static vreau pentru Raspberry Pi

netstat -nr
sudo nano /etc/dhcpcd.conf
Ce nseamna IP/24 cum am gasit mai sus la telefon 192.168.43.49/24

In dhcpcd.conf pun la inceput


Interface eth0
Static ip_address=10.0.0.39/24
static routers=10.0.0.1
static domain_name_servers=8.8.8.8 8.8.4.4
linie libera
sudo reboot
putty cu noua adresa ip 10.0.0.39

Folosire internet prin Wif sau USB, lucrul cu LAN i WAN


Aici arat cum extend reeaua mea Wifi local la una public cu VPN
VPN server. Ofer encriptare, sigurana informaiilor

Ecran VNC de pe telefon cu Wifi

https://www.youtube.com/watch?v=21120acDbuY
tightvncserver
se creaz fiierul: sudo nano /etc/init.d/vncboot
cu coninutul din video pentru tightvncserver
sudo chmod 755 /etc/init.d/vncboot
sudo update -rc.d vncboot defaults
modific sudo nano .vnc/xstartup
conectez telefonul la aceeasi retea ca pi, cu apk vnc viewer
aflu adresa IP pi din putty, cu ifconfig wlan0
pun in aplicaia telefonului vnc viewer adresa zrmata de numaul portului :1, :2 sau
:3, ca la tightvncserver.
A folost acest adaptor Wifi
http://www.amazon.in/TP-Link-TL-WN722N-150Mbps-Wireless-
Adapter/dp/B002SZEOLG?ie=UTF8&keywords=TP-LINK
%20WN722N&linkCode=sl1&linkId=2cc16b59cbd719fd10f681b25a73815e&qid=14
80130613&ref_=as_li_ss_tl&sr=8-1&tag=pnpt-21
Am impresia ca a folosit un ruter wifi.
Accesare camer de pe telefon prin WiFi

Reea WIFI
https://www.element14.com/community/docs/DOC-81701/l/the-ultimate-
smartphone-controlled-portable-raspberry-pi-3-camera
1) Aplicaie imediat
2) Hotspot pe tel. Nu este sigur c ntotdeauna este aceeai adres
3) Se seteaz Rasspberry Pi 3 ca hotspot.

Caut raspberry pi server internet wifi


https://cdn-learn.adafruit.com/downloads/pdf/setting-up-a-raspberry-pi-as-a-wifi-
access-point.pdf

Raspberry Pi - Web Server / Wireless Access Point (WAP)


http://www.instructables.com/id/Raspberry-Pi-Web-Server-Wireless-Access-Point-
WAP/

Confgurare reea, bun


https://wiki.archlinux.org/index.php/Network_configuration
Adrese IP fixe 8.8.8.8 si 8.8.4.4 sunt a free, global Domain Name System (DNS)
resolution service, that you can use as an alternative to your current DNS provider.
Ping 8.8.8.8
a favourite IP address to ping in Australia at 139.130.4.5 which is the primary name
server for the largest carrier in Australia. Ive also used the servers at OpenDNS
208.67.222.222 and 208.67.220.220. OpenDNS provides a secure and safe DNS
service which I recommend that you check out for home and commercial use.
Norton Connectsafe also have secure DNS servers for home users at 198.153.192.1
and 198.153.194.2 that respond to ICMP requests.

DNSResolvers.com is another DNS servers 205.210.42.205 and 64.68.200.200 as a free service from
EasyDNS.

If the ping failed with an Unknown hosts error, it means that your machine was
unable to resolve this domain name. It may be related to your service provider or
your router/gateway. Try pinging a static IP address to prove that your machine has
access to the Internet:
Pentru acces la DNS, /etc/resolv.conf
Fisierul /etc/hostname
Contine linia

myhostname
common modules are 8139too for cards with a Realtek chipset, or sis900 for cards
with a SiS chipset.

ipEnable i disable interfee reea


Ip link set eth0 up
Ip link set eth0 down
Dac folosesc o adres static, fiolosesc NUMAI metode pentru adrese statice, nu le
amestec cu cele pentru reea dinamic.
Dac folosesc adres dinamic, folosesc numai metode specifice pentru adrese
dinamice.

Adres IP dinamic, metode:


systemd-networkd
An easy way to setup DHCP for simple requirements is to use systemd-networkd service provided by systemd. See systemd-networkd#Basic DHCP
network.
dhcpcd
dhcpcd is the default client in Arch Linux to setup DHCP on the installation ISO. It is a powerful tool with many configurable DHCP client options. See
dhcpcd#Running on how to activate it for an interface.
dhclient
dhclient is the Internet Systems Consortium DHCP client. Enable the dhclient@interface.service, where interface is a wired #Device name. See dhclient(8)
and dhclient.conf(5) for details.
netctl
netctl is a CLI-based tool for configuring and managing network connections through user-created profiles. Create a profile as shown in netctl#Example
profiles, then enable it as described in netctl#Basic method.

Adres IP static, metode


A static IP address can be configured with most standard Arch Linux networking tools. Independent of the tool you
choose, you will probably need to be prepared with the following information:
Static IP address
Subnet mask, or possibly its CIDR notation, for example /24 is the CIDR notation of 255.255.255.0 netmask.
Broadcast address
Gateway's IP address
Name server (DNS) IP addresses. See also resolv.conf.
If you are running a private network, it is safe to use IP addresses in 192.168.*.* for your IP addresses, with a
subnet mask of 255.255.255.0 and a broadcast address of 192.168.*.255. The gateway is usually 192.168.*.1 or
192.168.*.254.
netctl
To create a netctl profile with a static IP, set the IP=static option as well as Address, Gateway, and DNS. See
netctl#Wired.
systemd-networkd
The systemd-networkd service provided by systemd can set up a static IP using a simple configuration file. See
systemd-networkd#Wired adapter using a static IP.
dhcpcd
See dhcpcd#Static profile.

Asignare manual IP static (care dispare la reboot)


It is possible to manually set up a static IP using only the iproute2 package. This is a good way to test connection
settings since the connection made using this method will not persist across reboots. First enable the network
interface:
# ip link set interface up
Assign a static IP address in the console:
# ip addr add IP_address/subnet_mask broadcast broadcast_address dev interface
Then add your gateway IP address:
# ip route add default via default_gateway
For example:
# ip link set eth0 up
# ip addr add 192.168.1.2/24 broadcast 192.168.1.255 dev eth0
# ip route add default via 192.168.1.1
Tip: If you get the message RTNETLINK answers: Network is unreachable, try to break up the route creation in the
following two parts:
# ip route add 192.168.1.1 dev eth0
# ip route add default via 192.168.1.1 dev eth0
To undo these steps (e.g. before switching to a dynamic IP), first remove any assigned IP address:
# ip addr flush dev interface
Then remove any assigned gateway:
# ip route flush dev interface
And finally disable the interface:
# ip link set interface down
Configurare reea cnd cablul de etrhernet sau stickul Wifi este introdus i
deconfigurare la scoatere

Ifplugd
Tip: dhcpcd provides the same feature out of the box.
ifplugd in official repositories is a daemon which will automatically configure your Ethernet device when a cable is
plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network
adapters, since it will only configure the interface when a cable is really connected. Another use is when you just
need to restart the network but do not want to restart the computer or do it from the shell.
By default it is configured to work for the eth0 device. This and other settings like delays can be configured in
/etc/ifplugd/ifplugd.conf.
Note: netctl package includes netctl-ifplugd@.service, otherwise you can use ifplugd@.service from ifplugd
package. For example, enable ifplugd@eth0.service.

IP address aliasing
IP aliasing is the process of adding more than one IP address to a network interface. With this, one node on a
network can have multiple connections to a network, each serving a different purpose. Typical uses are virtual
hosting of Web and FTP servers, or reorganizing servers without having to update any other machines (this is
especially useful for nameservers).

Multe alte probleme, inclusiv cu driverele.

Din alt loc ce am mai neles.


1) Dac am o masc cu k bii pe 1, atunci pot indica adresa IP spunnd 192.168-
1.2/k = CIDR Notation. nseamn c am 32-k bii pe 0, deci pot folosi 2 32+k+2
npduri. Prima adres este pentru reea i ultima pentru broadcast.
192.168.1.5/24 nseamn c am masca 255.255.255.000, adresa de reea
192.168.1.0, adresa de broadcast 192.168.1.255 i adresa dat este adresa
unui nod.
2) Adres static, adic pot pune o adresa pe care o vreau disponibil n reea
(n exemplul de mai sus adrese ntre 192.168.1.1 i 192.168.1.254). Am putut
s o definesc n ruter. Ruterul o va folkosi automat, fr comand. Bun
pentru a lega calculatorul la Internet.
3) Adres dhp, adic trebuie s dau comanda dhclient eth0 pentru ca ruterul s
i-o atribuie, poate nu aceeai ca alt dat.

https://help.ubuntu.com/12.04/serverguide/network-configuration.html
Comenzi retea: http://www.computerhope.com/unix/uifconfi.htm
Iconfig configurare retele
Eth0, wlan0, lo (interfata de comunicare cu calc insusi 127.0.0.1)
Ifconfig se af toate int active
Ifconfig -a se af toate interf, si cele inactive. Observ ca nu am wlan0
Sudo ifconfig eth0 up enable, activare
Sudo ifconfig eth0 down disable, inactivare
Sudo ifconfig wlan0 100.20,223.123 da interfetei un IP static
Sudo ifconfig wlan0 netmask 255,255,255,0 asigneaza o masca
Sudo ifconfig lan0 broadcast 211.200.11.198
sudo ifconfig eth0 192.168.2.5 netmask 255.255.255.0 broadcast 192.168.2.7
De obicei nu se folosesc pentru ca este un fisier de configurare care este
executat automat la boot pentru adresele IP statice.

Pentru configurari temporare se folosesc ip, ifconfig si route.

DHCP protocol:
1) Clientul contacteaza un server care are o lista de adrese IP pentru a primi una
ca sa comunice in retea
2) Clientul afla date despre retea> localizarea ruterului si a name serverului.
Exista fisierul dhclient.leases cu adrese asignate clientilor.
Dhclient eth0 reinloieste adresa dinamica IP.
Sudo route add default gw 10.0.0.1 eth0 Configurare default gateway
Route n afiseaza gateway implicit la mine da 192.168.1.1
If you require DNS for your temporary network configuration, you can add DNS server IP
addresses in the file /etc/resolv.conf. The example below shows how to enter two DNS servers to
/etc/resolv.conf, which should be changed to servers appropriate for your network. A more
lengthy description of DNS client configuration is in a following section.
nameserver 8.8.8.8
nameserver 8.8.4.4
In rezolv.conf am gasit nameserver = DNS server
193.231.252.1 si 213.154.124.1 = adresa RCS
In windows aflu date cu ipconfg /all
If you no longer need this configuration and wish to purge all IP configuration from an interface,
you can use the ip command with the flush option as shown below.
ip addr flush eth0
Flushing the IP configuration using the ip command does not clear the contents of
/etc/resolv.conf. You must remove or modify those entries manually.
Ip addr show Adresa calculatorului din retea, nu cea pe internet
curl ipecho.net/plain ; echo
sau
curl icanhazip.com
Ca sa aflu din Linux adresa mea de internet externa
Bineinteles ca o am si in panoul de configurare al ruterului.

Asignare de adresa dinamica DHCP

in the file /etc/network/interfaces.


auto eth0
iface eth0 inet dhcp

sudo ifup eth0 enable interfata


sudo ifdown eth0

Asignare de adrese IP statice

in the file /etc/network/interfaces.


auto eth0
iface eth0 inet static
address 10.0.0.100 o pun pe care o vreau eu, din cele disp
netmask 255.255.255.0
gateway 10.0.0.1

sudo ifup eth0 enable interfata


sudo ifdown eth0

Name resolution pentru IP dinamica


Name resolution = mapare adrese IP la hostnames
Initial /etc/resolv.conf era fixat si apoi neschimbat. Dar azi se schimba des reteaua si
de aceea se foloseste rezolvconf pentru a urmari ce schimbari au fost si a se
schimba automat rezolverul.
Aveam rezolv.conf, dar acum am si /rezolvconf/rezolv.conf
Orice se schimba in rezolvconf va updata rezolv.conf si de aceea ce se scrie in
rezolv.conf va fi suprascris.
Instead, resolvconf uses DHCP client hooks, and /etc/network/interfaces to generate a list of
nameservers and domains to put in /etc/resolv.conf, which is now a symlink:
/etc/resolv.conf -> ../run/resolvconf/resolv.conf
Daca inteleg, fac o corespondenta intre nume si adresa IP.
To configure the resolver, add the IP addresses of the nameservers that are appropriate for your
network in the file /etc/network/interfaces. You can also add an optional DNS suffix search-lists
to match your network domain names. For each other valid resolv.conf configuration option, you
can include, in the stanza, one line beginning with that option name with a dns- prefix. The
resulting file might look like the following:
iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com
dns-nameservers 192.168.3.45 192.168.8.10
Pentru a se cauta in domeniul dat si in subdomenii:
The search option can also be used with multiple domain names so that DNS queries will be
appended in the order in which they are entered. For example, your network may have multiple
sub-domains to search; a parent domain of example.com, and two sub-domains,
sales.example.com and dev.example.com.
If you have multiple domains you wish to search, your configuration might look like the
following:
iface eth0 inet static
address 192.168.3.3 o pun pe care o vreau eu, din cele disp
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com sales.example.com dev.example.com
dns-nameservers 192.168.3.45 192.168.8.10

Static Hostnames

Eu am:

127.0.0.1 localhgost

127.0.1.1 raspberrypi

Fisierul /etc/hosts este cercetat inainte de DNS.

Static hostnames are locally defined hostname-to-IP mappings located in the file /etc/hosts.
Entries in the hosts file will have precedence over DNS by default. This means that if your
system tries to resolve a hostname and it matches an entry in /etc/hosts, it will not attempt to look
up the record in DNS. In some configurations, especially when Internet access is not required,
servers that communicate with a limited number of resources can be conveniently set to use
static hostnames instead of DNS.

The following is an example of a hosts file where a number of local servers have been identified
by simple hostnames, aliases and their equivalent Fully Qualified Domain Names (FQDN's).

127.0.0.1 localhost
127.0.1.1 ubuntu-server
10.0.0.11 server1 server1.example.com vpn
10.0.0.12 server2 server2.example.com mail
10.0.0.13 server3 server3.example.com www
10.0.0.14 server4 server4.example.com file

In the above example, notice that each of the servers have been given aliases in addition to their
proper names and FQDN's. Server1 has been mapped to the name vpn, server2 is referred to as
mail, server3 as www, and server4 as file.

Nestudiat:

Name Service Switch Configuration

The order in which your system selects a method of resolving hostnames to IP addresses is
controlled by the Name Service Switch (NSS) configuration file /etc/nsswitch.conf. As
mentioned in the previous section, typically static hostnames defined in the systems /etc/hosts
file have precedence over names resolved from DNS. The following is an example of the line
responsible for this order of hostname lookups in the file /etc/nsswitch.conf.

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

files first tries to resolve static hostnames located in /etc/hosts.

mdns4_minimal attempts to resolve the name using Multicast DNS.

[NOTFOUND=return] means that any response of notfound by the preceding


mdns4_minimal process should be treated as authoritative and that the system should not
try to continue hunting for an answer.

dns represents a legacy unicast DNS query.

mdns4 represents a Multicast DNS query.

To modify the order of the above mentioned name resolution methods, you can simply change
the hosts: string to the value of your choosing. For example, if you prefer to use legacy Unicast
DNS versus Multicast DNS, you can change the string in /etc/nsswitch.conf as shown below.
hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4
Bridging

Bridging multiple interfaces is a more advanced configuration, but is very useful in multiple
scenarios. One scenario is setting up a bridge with multiple network interfaces, then using a
firewall to filter traffic between two network segments. Another scenario is using bridge on a
system with one interface to allow virtual machines direct access to the outside network. The
following example covers the latter scenario.

Before configuring a bridge you will need to install the bridge-utils package. To install the
package, in a terminal enter:

sudo apt-get install bridge-utils

Next, configure the bridge by editing /etc/network/interfaces:

auto lo
iface lo inet loopback

auto br0
iface br0 inet static
address 192.168.0.10
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

Enter the appropriate values for your physical interface and network.

Now restart networking to enable the bridge interface:

sudo /etc/init.d/networking restart


The new bridge interface should now be up and running. The brctl provides useful
information about the state of the bridge, controls which interfaces are part of the
bridge, etc. See man brctl for more information