» »

Kako najenostavneje pridobiti IP iz windowsa 7?

Kako najenostavneje pridobiti IP iz windowsa 7?

Pesimist ::

Ce imas dva ipja, katera sta po vrhu dinamicni in se spreminjata pogost oz vsakic ko jih povezes. Torej ce je kaksen enostavni nacin pridobiti ta IPja, in ga avtomatsko prerutat na dolocene druge ipje.

Trenutno delam vse na roko.
1. ipconfig
2. copy pppoe1 in pppoe2 IP.
3. paste v pppoe1.bat pppoe1 in pppoe2.bat pppoe2, kot route add xx.xxx.xx.x MASK 255.255.255.0 xxx.xxx.xxx.xxx
4. execute oba .bat

Rad bi pa preskocil spreminjanje prvega dinamcinega IPja v teh skriptak vsakic. V linuxu razumem da gre to naret z aliasom. V windowsu je kaksna komanda da bi bi samo napisal add pppoe1 MASK 255.255.255.0 xxx.xxx.xxx.xxx ?
  • spremenilo: Pesimist ()

D3xt3r ::

jan01 ::

kot powershell skripto?
$ime1 = 'TVOJE IME POVEZAVE1'
$ime2 = 'TVOJE IME POVEZAVE2'
#vpiši ime povezave, recimo pogledaš s ukazom get-wmiobject win32_NetworkAdapterConfiguration
$ip1 = (get-wmiobject win32_NetworkAdapterConfiguration -filter "Description='$ime1'").IPAddress
$ip2 = (get-wmiobject win32_NetworkAdapterConfiguration -filter "Description='$ime2'").IPAddress
add $ip1 MASK 255.255.255.0 $ip2

//poglej, če je vse prav. lahko vse stlačiš v vrsico...

Pesimist ::

Hm zanimiv nacin.
Ta komanda sploh ne prikaze get-wmiobject win32_NetworkAdapterConfiguration mojih pppoe povezav in njihovih IPjev.

Potem pa add $ip1 MASK 255.255.255.0 $ip2
prvi $ip1 je vedno en staticni ip kot recimo 209.85.129.103. Neznaka je samo IP2, katerega vedno na roko spreminjam.

Pesimist ::

Najso sem komando kak priti do IPja.
netsh interface ipv4 show addresses "PPPOE1" | select-string "IP Address"

Zaj pa dalje neznam. :(

route add 209.85.129.103 MASK 255.255.255.0 "PPPOE1"

Pesimist ::

$ip = netsh interface ip show address "PPPOE1" | select-string "IP Address"
route add 69.16.176.250 MASK 255.255.255.255 "$ip"


Tu pa rece da je narobe routing tabla kar seveda je sej "$ip" nima kaj za iskat tam vbistvu. Ampak nevem kak bi drugac :(

ROUTE.EXE : The route addition failed: The parameter is incorrect.
At line:4 char:6
+ route <<<<  ADD 69.16.176.250 MASK 255.255.255.255 $ime1
    + CategoryInfo          : NotSpecified: (The route addit...r is incorrect.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Zgodovina sprememb…

  • spremenilo: Pesimist ()

jan01 ::

Vzpostavi pppoe povezavo,d a boš videl s get-wmiobject win32_NetworkAdapterConfiguration

$ip = (get-wmiobject win32_NetworkAdapterConfiguration -filter "Description='WAN (PPP/SLIP) Interface'").IPAddress

route add 209.85.129.103 MASK 255.255.255.0 $ip


Lahko v skripti recimo dodaš še preverjanje if(!$ip)...

Pesimist ::

Ta komanda je ne prikaze, ali pa je jaz ne vidim, kot sam vidis spodaj. IP pa pokaze ta komanda kamot.
netsh interface ipv4 show addresses "PPPOE2" | select-string "IP Address"

Vendar to route add 209.85.129.103 MASK 255.255.255.0 $ip ne deluje ker druga kot IP stevilko v zadnjem delu nemores podajat ker windows ne razume aliasov ocitno in dobivam nonstop isti error v vseh primerih.

route add 209.85.129.103 MASK 255.255.255.0 $ip
ROUTE.EXE : 
At line:4 char:6
+ route <<<<  add 209.85.129.103 MASK 255.255.255.0 $ip
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Manipulates network routing tables.

ROUTE [-f] [-p] [-4|-6] command [destination]
                  [MASK netmask]  [gateway] [METRIC metric]  [IF interface]

  -f           Clears the routing tables of all gateway entries.  If this is
               used in conjunction with one of the commands, the tables are
               cleared prior to running the command.
               
  -p           When used with the ADD command, makes a route persistent across
               boots of the system. By default, routes are not preserved
               when the system is restarted. Ignored for all other commands, 
               which always affect the appropriate persistent routes. This 
               option is not supported in Windows 95.
               
  -4           Force using IPv4.

  -6           Force using IPv6. 
  
  command      One of these:
                 PRINT     Prints  a route
                 ADD       Adds    a route
                 DELETE    Deletes a route
                 CHANGE    Modifies an existing route    
  destination  Specifies the host.
  MASK         Specifies that the next parameter is the 'netmask' value.
  netmask      Specifies a subnet mask value for this route entry.
               If not specified, it defaults to 255.255.255.255.
  gateway      Specifies gateway.
  interface    the interface number for the specified route.
  METRIC       specifies the metric, ie. cost for the destination.

All symbolic names used for destination are looked up in the network database
file NETWORKS. The symbolic names for gateway are looked up in the host name
database file HOSTS.

If the command is PRINT or DELETE. Destination or gateway can be a wildcard,
(wildcard is specified as a star '*'), or the gateway argument may be omitted.

If Dest contains a * or ?, it is treated as a shell pattern, and only
matching destination routes are printed. The '*' matches any string,
and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.

Pattern match is only allowed in PRINT command.
Diagnostic Notes:
    Invalid MASK generates an error, that is when (DEST & MASK) != DEST.
    Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1
             The route addition failed: The specified mask parameter is invalid. (Destination & Mask) != Destination.

Examples:

    > route PRINT
    > route PRINT -4
    > route PRINT -6
    > route PRINT 157*          .... Only prints those matching 157*
    
    > route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2
             destination^      ^mask      ^gateway     metric^    ^
                                                         Interface^
      If IF is not given, it tries to find the best interface for a given 
      gateway.
    > route ADD 3ffe::/32 3ffe::1
    
    > route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2
    
      CHANGE is used to modify gateway and/or metric only.
    
    > route DELETE 157.0.0.0
    > route DELETE 3ffe::/32





DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : RasSstp
Description      : WAN Miniport (SSTP)
Index            : 0

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : RasAgileVpn
Description      : WAN Miniport (IKEv2)
Index            : 1

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : Rasl2tp
Description      : WAN Miniport (L2TP)
Index            : 2

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : PptpMiniport
Description      : WAN Miniport (PPTP)
Index            : 3

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : RasPppoe
Description      : WAN Miniport (PPPOE)
Index            : 4

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : NdisWan
Description      : WAN Miniport (IPv6)
Index            : 5

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : NdisWan
Description      : WAN Miniport (Network Monitor)
Index            : 6

DHCPEnabled      : False
IPAddress        : {192.168.1.2, fe80::7951:913c:fd92:c653}
DefaultIPGateway : {192.168.1.1}
DNSDomain        : 
ServiceName      : RTL8167
Description      : Realtek PCI GBE Family Controller
Index            : 7

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : NdisWan
Description      : WAN Miniport (IP)
Index            : 8

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 9

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : AsyncMac
Description      : RAS Async Adapter
Index            : 10

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft Teredo Tunneling Adapter
Index            : 11

DHCPEnabled      : False
IPAddress        : {10.120.42.19, fe80::592d:df9a:e891:3947}
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : yukonw7
Description      : Marvell Yukon 88E8056 PCI-E Gigabit Ethernet Controller
Index            : 12

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 13

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : VirtualBox Bridged Networking Driver Miniport
Index            : 14

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : VirtualBox Bridged Networking Driver Miniport
Index            : 15

DHCPEnabled      : True
IPAddress        : {169.254.169.230, fe80::2140:a735:f6d4:a9e6}
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : VBoxNetAdp
Description      : VirtualBox Host-Only Ethernet Adapter
Index            : 16

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 17

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : cfosbc
Description      : cFos Broadband Connect (NDIS 6.0) Adapter
Index            : 18

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft 6to4 Adapter
Index            : 19

DHCPEnabled      : False
IPAddress        : {192.168.68.1, fe80::f04a:a921:e52:3144}
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : VMnetAdapter
Description      : VMware Virtual Ethernet Adapter for VMnet1
Index            : 20

DHCPEnabled      : False
IPAddress        : {192.168.198.1, fe80::c89b:21f7:d9ca:3de5}
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : VMnetAdapter
Description      : VMware Virtual Ethernet Adapter for VMnet8
Index            : 21

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 22

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 23

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 24

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 25

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : cFosSpeed Miniport
Index            : 26

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : cFosSpeed Miniport
Index            : 27

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : cFosSpeed Miniport
Index            : 28

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : cFosSpeed Miniport
Index            : 29

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : cFosSpeed Miniport
Index            : 30

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : 
Description      : cFosSpeed Miniport
Index            : 31

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 32

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 33

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 34

DHCPEnabled      : False
IPAddress        : 
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : tunnel
Description      : Microsoft ISATAP Adapter
Index            : 35

Zgodovina sprememb…

  • spremenilo: Pesimist ()

Pesimist ::

Ok hvala za vse. Mi ze deluje kot velikemu.


$ime1=netsh interface ipv4 show addresses "PPPOE2" | select-string "IP Address"|foreach{$_.tostring().split(":")[1].trimstart()}

route ADD 69.xx.xx.xx.xx MASK 255.255.255.255 $ime1

Zgodovina sprememb…

  • spremenilo: Pesimist ()


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

Certifikat

Oddelek: Operacijski sistemi
71023 (893) videc
»

Težave - internet

Oddelek: Omrežja in internet
301590 (1328) megy
»

Šifriranje vsebine Win 7

Oddelek: Pomoč in nasveti
191443 (1029) energetik
»

Problem z internetom

Oddelek: Pomoč in nasveti
473183 (2734) RuskiSnajper
»

Problem router/mordem

Oddelek: Omrežja in internet
152673 (2360) gorenjc

Več podobnih tem