Quantcast
Channel: Win32_NetworkAdapterConfiguration | Operating systems, scripting, PowerShell and security | jesusninoc.com
Viewing all articles
Browse latest Browse all 37

Cmdlets for TCP/IP Model Layers

$
0
0
Cmdlets for TCP/IP Model Layers

The architecture of the TCP/IP protocol suite by Microsoft (https://technet.microsoft.com/en-us/library/bb726993.aspx)

 

Layer 1. Network Interface Layer

The Network Interface layer (also called the Network Access layer) sends TCP/IP packets on the network medium and receives TCP/IP packets off the network medium. TCP/IP was designed to be independent of the network access method, frame format, and medium. Therefore, you can use TCP/IP to communicate across differing network types that use LAN technologies—such as Ethernet and 802.11 wireless LAN—and WAN technologies—such as Frame Relay and Asynchronous Transfer Mode (ATM). By being independent of any specific network technology, TCP/IP can be adapted to new technologies.

The Network Interface layer of the DARPA model encompasses the Data Link and Physical layers of the OSI model. The Internet layer of the DARPA model does not take advantage of sequencing and acknowledgment services that might be present in the Data Link layer of the OSI model. The Internet layer assumes an unreliable Network Interface layer and that reliable communications through session establishment and the sequencing and acknowledgment of packets is the responsibility of either the Transport layer or the Application layer.

Hardware information of the network adapter

Get-NetAdapterHardwareInfo


Returns all physical network adapters

Get-NetAdapter -Physical


Networking statistics from the network adapter. The statistics include broadcast, multicast, discards, and errors

Get-NetAdapterStatistics

 

Layer 2. Internet Layer

The Internet layer responsibilities include addressing, packaging, and routing functions. The Internet layer is analogous to the Network layer of the OSI model.

The core protocols for the IPv4 Internet layer consist of the following:

  • The Address Resolution Protocol (ARP) resolves the Internet layer address to a Network Interface layer address such as a hardware address.
  • The Internet Protocol (IP) is a routable protocol that addresses, routes, fragments, and reassembles packets.
  • The Internet Control Message Protocol (ICMP) reports errors and other information to help you diagnose unsuccessful packet delivery.
  • The Internet Group Management Protocol (IGMP) manages IP multicast groups.

For more information about the core protocols for the IPv4 Internet layer, see “IPv4 Internet Layer” later in this chapter.

The core protocols for the IPv6 Internet layer consist of the following:

  • IPv6 is a routable protocol that addresses and routes packets.
  • The Internet Control Message Protocol for IPv6 (ICMPv6) reports errors and other information to help you diagnose unsuccessful packet delivery.
  •  

    The Neighbor Discovery (ND) protocol manages the interactions between neighboring IPv6 nodes.

  • The Multicast Listener Discovery (MLD) protocol manages IPv6 multicast groups.

MAC (Media Access Control)

Get the current MAC

Get-NetAdapter | Select-Object Name,MacAddress
Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Select-Object Description,MACAddress


Neighbor cache entries (The neighbor cache maintains information for each on-link neighbor, including the IP address and the associated link-layer address. In IPv4, the neighbor cache is commonly known as the Address Resolution Protocol (ARP) cache)

Get-NetNeighbor

 

IP (Internet Protocol)

Get the current IP address

Get-NetIPAddress | Select-Object InterfaceAlias,IPAddress
Get-NetIPAddress -AddressFamily ipv4
Get-NetIPAddress -AddressFamily ipv6
Get-NetIPConfiguration


IP version supported by the network adapter

((Get-NetAdapterBinding).DisplayName) -match 'Protocolo de Internet'
(Get-NetIPInterface) | Select-Object InterfaceAlias,AddressFamily


Information about IP version

Get-NetIPv4Protocol
Get-NetIPv6Protocol


Assign a static IP address

New-NetIPAddress -InterfaceAlias Wi-Fi -IPAddress 192.168.1.56 -PrefixLength 24 -DefaultGateway 192.168.1.1


IP route information from the IP routing table

Get-NetRoute

 

NAT (Network Address Translation)

Information about NAT

Get-NetNat
Get-NetNatExternalAddress
Get-NetNatGlobal
Get-NetNatSession
Get-NetNatStaticMapping
Get-NetNatTransitionConfiguration
Get-NetNatTransitionMonitoring

 

Firewall

Information about firewall

Get-NetFirewallAddressFilter
Get-NetFirewallApplicationFilter
Get-NetFirewallInterfaceFilter
Get-NetFirewallInterfaceTypeFilter
Get-NetFirewallPortFilter
Get-NetFirewallProfile
Get-NetFirewallRule
Get-NetFirewallSecurityFilter
Get-NetFirewallServiceFilter
Get-NetFirewallSetting

 

ICMP (Internet Control Message Protocol)

Sends ICMP echo request packets (“pings”) to one or more computers

Test-Connection

 

Layer 3. Transport Layer

The Transport layer (also known as the Host-to-Host Transport layer) provides the Application layer with session and datagram communication services. The Transport layer encompasses the responsibilities of the OSI Transport layer. The core protocols of the Transport layer are TCP and UDP.

TCP provides a one-to-one, connection-oriented, reliable communications service. TCP establishes connections, sequences and acknowledges packets sent, and recovers packets lost during transmission.

In contrast to TCP, UDP provides a one-to-one or one-to-many, connectionless, unreliable communications service. UDP is used when the amount of data to be transferred is small (such as the data that would fit into a single packet), when an application developer does not want the overhead associated with TCP connections, or when the applications or upper-layer protocols provide reliable delivery.

TCP and UDP operate over both IPv4 and IPv6 Internet layers.

TCP (Transmission Control Protocol)

Settings

Get-NetTCPSetting


Gets information about current connection statistics

Get-NetTCPConnection


Ports

Get-NetTCPConnection | Select-Object LocalPort,Remoteport

 

UDP (User Datagram Protocol)

Settings

Get-NetUDPSetting


Gets information about current connection statistics

Get-NetUDPEndpoint


Ports

(Get-NetUDPEndpoint).LocalPort

 

Layer 4. Application Layer

The Application layer allows applications to access the services of the other layers, and it defines the protocols that applications use to exchange data. The Application layer contains many protocols, and more are always being developed.

The most widely known Application layer protocols help users exchange information:

  • The Hypertext Transfer Protocol (HTTP) transfers files that make up pages on the World Wide Web.
  • The File Transfer Protocol (FTP) transfers individual files, typically for an interactive user session.
  • The Simple Mail Transfer Protocol (SMTP) transfers mail messages and attachments.

Additionally, the following Application layer protocols help you use and manage TCP/IP networks:

  • The Domain Name System (DNS) protocol resolves a host name, such as www.microsoft.com, to an IP address and copies name information between DNS servers.
  • The Routing Information Protocol (RIP) is a protocol that routers use to exchange routing information on an IP network.
  • The Simple Network Management Protocol (SNMP) collects and exchanges network management information between a network management console and network devices such as routers, bridges, and servers.

Windows Sockets and NetBIOS are examples of Application layer interfaces for TCP/IP applications. For more information, see “Application Programming Interfaces” later in this chapter.

HTTP/HTTPS (Hypertext Transfer Protocol/Hypertext Transfer Protocol Secure)

Information about HTTP/HTTPS

Invoke-WebRequest
Start-BitsTransfer

 

Proxy

Information about proxy

Invoke-WebRequest -Proxy
New-WebServiceProxy

 

DNS (Domain Name System)

Information about DNS

Get-DnsClient
Get-DnsClientCache
Get-DnsClientGlobalSetting
Get-DnsClientNrptGlobal
Get-DnsClientNrptPolicy
Get-DnsClientNrptRule
Get-DnsClientServerAddress


Performs a DNS name resolution for the specified name

Resolve-DnsName


Resolves a host name or IP address to an IPHostEntry instance

[Net.DNS]::GetHostEntry()


Clears the contents of the DNS client cache

Clear-DnsClientCache


Clears resource records from a cache on the DNS server

 Clear-DnsServerCache

 

FTP (File Transfer Protocol)

Upload file using FTP

$ftp=”ftp://user:pass@domain.com/pub/$File”
$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($ftp)
$webclient.UploadFile($uri, $file)

 

SMTP (Simple Mail Transfer Protocol)

Sends an email message

Send-MailMessage -To ‘user2@gmail.com’ -From ‘user1@example.com’ -Subject ‘Fichero comprimido’ -Attachments $ficherodestino -SmtpServer localhost

The post Cmdlets for TCP/IP Model Layers appeared first on Scripting and security.


Viewing all articles
Browse latest Browse all 37

Latest Images

Trending Articles





Latest Images